Perldoc Search: "$a" perl-5.20.1

search official POD


44 PODs, 564 LINEs found.
perlfunc.pod
184 :             print "Can do.\n" if -r $a || -w _ || -x _;
373 :             chomp($answer = <STDIN>);
377 :         Note that parentheses are necessary when you're chomping anything that is not a simple variable. This is because "chomp $cwd = `pwd`;" is interpreted as "(chomp $cwd) = `pwd`;", rather than as "chomp( $cwd = `pwd` )" which you might expect. Similarly, "chomp $a, $b" is interpreted as "chomp($a), $b" rather than as "chomp($a, $b)".
626 :                 delete $ARRAY[$index];
852 :             eval { $answer = $a / $b; }; warn $@ if $@;
855 :             eval '$answer = $a / $b'; warn $@ if $@;
858 :             eval { $answer = }; # WRONG
861 :             eval '$answer =';   # sets $@
866 :             eval { local $SIG{'__DIE__'}; $answer = $a / $b; };
949 :             exec { $args[0] } @args;  # safe even with one-arg list
955 :         Perl attempts to flush all files opened for output before the exec, but this may not be supported on some platforms (see perlport). To be safe, you may need to set $| ($AUTOFLUSH in English) or call the "autoflush()" method of "IO::Handle" on any open handles to avoid lost output.
970 :             print "Exists\n"    if exists $array[$index];
971 :             print "Defined\n"   if defined $array[$index];
972 :             print "True\n"      if $array[$index];
1008 :             $ans = <STDIN>;
1009 :             exit 0 if $ans =~ /^[Xx]/;
1147 :         Perl attempts to flush all files opened for output before forking the child process, but this may not be supported on some platforms (see perlport). To be safe, you may need to set $| ($AUTOFLUSH in English) or call the "autoflush()" method of "IO::Handle" on any open handles to avoid duplicate output.
1173 :         This is an internal function used by "format"s, though you may call it, too. It formats (see perlform) a list of values according to the contents of PICTURE, placing the output into the format output accumulator, $^A (or $ACCUMULATOR in English). Eventually, when a "write" is done, the contents of $^A are written to some filehandle. You could also read $^A and then set $^A back to "". Note that a format typically does one "formline" per line of form, but the "formline" function itself doesn't care how many newlines are embedded in the PICTURE. This means that the "~" and "~~" tokens treat the entire PICTURE as a single line. You may therefore need to use multiple formlines to implement a single record format, just like the "format" compiler.
1273 :          ( $name,   $aliases,  $addrtype,  $net      ) = getnet*
1274 :          ( $name,   $aliases,  $port,      $proto    ) = getserv*
1275 :          ( $name,   $aliases,  $proto                ) = getproto*
1276 :          ( $name,   $aliases,  $addrtype,  $length,  @addrs ) = gethost*
1295 :         In *getpw*()* the fields $quota, $comment, and $expire are special in that they are unsupported on many systems. If the $quota is unsupported, it is an empty scalar. If it is supported, it usually encodes the disk quota. If the $comment field is unsupported, it is an empty scalar. If it is supported it usually encodes some administrative comment about the user. In some systems the $quota field may be $change or $age, fields that have to do with password aging. In some systems the $comment field may be $class. The $expire field, if present, encodes the expiration period of the account or the password. For the availability and the exact meaning of these fields in your system, please consult getpwnam(3) and your system's pwd.h file. You can also find out from within Perl what your $quota and $comment fields mean and whether you have the $expire field by using the "Config" module and the values "d_pwquota", "d_pwage", "d_pwchange", "d_pwcomment", and "d_pwexpire". Shadow password files are supported only if your vendor has implemented them in the intuitive fashion that calling the regular C library routines gets the shadow versions if you're running under privilege or if there exists the shadow(3) functions as found in System V (this includes Solaris and Linux). Those systems that implement a proprietary shadow password facility are unlikely to be supported.
1301 :             ($a,$b,$c,$d) = unpack('W4',$addr[0]);
1512 :             foreach $key (sort { $hash{$b} <=> $hash{$a} } keys %hash) {
1652 :             print "$abbr[$mon] $mday";
1921 :             $ARTICLE = 100;
1922 :             open(ARTICLE) or die "Can't find article $ARTICLE: $!\n";
1924 :         Here $ARTICLE must be a global (package) scalar variable - not one declared with "my" or "state".
1953 :             open(ARTICLE, "-|", "caesar <$article")  # decrypt article
1956 :             open(ARTICLE, "caesar <$article |")      # ditto
2084 :         Perl will attempt to flush all files opened for output before any operation that may do a fork, but this may not be supported on some platforms (see perlport). To be safe, you may need to set $| ($AUTOFLUSH in English) or call the "autoflush()" method of "IO::Handle" on any open handles.
2108 :             open(IN, $ARGV[0]) || die "can't open $ARGV[0]: $!";
2112 :             open(IN, "<", $ARGV[0])
2113 :                 || die "can't open < $ARGV[0]: $!";
2666 :                 $ARRAY[++$#ARRAY] = $value;
2798 :             foreach my $arg (@ARGV) {
2799 :                 open(my $fh, $arg) or warn "Can't open $arg: $!";
2803 :                         or die "readline failed for $arg: $!";
3012 :                 my ($arrayref, $filename) = @_;
3014 :                 my @parameters = @$arrayref[1..$#$arrayref];
3364 :         If the subroutine's prototype is "($$)", the elements to be compared are passed by reference in @_, as for a normal subroutine. This is slower than unprototyped subroutines, where the elements to be compared are passed into the subroutine as the package global variables $a and $b (see example below). Note that in the latter case, it is usually highly counter-productive to declare $a and $b as lexicals.
3366 :         If the subroutine is an XSUB, the elements to be compared are pushed on to the stack, the way arguments are usually passed to XSUBs. $a and $b are not set.
3384 :             @articles = sort {$a cmp $b} @files;
3387 :             @articles = sort {fc($a) cmp fc($b)} @files;
3390 :             @articles = sort {$b cmp $a} @files;
3393 :             @articles = sort {$a <=> $b} @files;
3396 :             @articles = sort {$b <=> $a} @files;
3400 :             @eldest = sort { $age{$b} <=> $age{$a} } keys %age;
3404 :                 $age{$a} <=> $age{$b};  # presuming numeric
3408 :             sub backwards { $b cmp $a }
3423 :                 ($b =~ /=(\d+)/)[0] <=> ($a =~ /=(\d+)/)[0]
3425 :                             fc($a)  cmp  fc($b)
3438 :                                    $nums[$b] <=> $nums[$a]
3440 :                                    $caps[$a] cmp $caps[$b]
3446 :                    sort { $b->[1] <=> $a->[1]
3448 :                           $a->[2] cmp $b->[2]
3454 :             sub backwards ($$) { $_[1] cmp $_[0]; }  # $a and $b are
3461 :             @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;
3465 :             @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;
3469 :             @contact = sort { $a cmp $b } find_records @key;
3481 :         If you're using strict, you *must not* declare $a and $b as lexicals. They are package globals. That means that if you're in the "main" package and type
3483 :             @articles = sort {$b <=> $a} @files;
3485 :         then $a and $b are $main::a and $main::b (or $::a and $::b), but if you're in the "FooPack" package, it's the same as typing
3491 :         Because "<=>" returns "undef" when either operand is "NaN" (not-a-number), be careful when sorting with a comparison function like "$a <=> $b" any lists that might contain a "NaN". The following example takes advantage that "NaN != NaN" to eliminate any "NaN"s from the input list.
3493 :             @result = sort { $a <=> $b } grep { $_ == $_ } @input;
3507 :             $a[$i] = $y         splice(@a,$i,1,$y)
3726 :               printf "address is %*vX\n", ":", $addr;   # IPv6 address
3869 :                 printf "<%*.*s>", $a, $b, $c;
3871 :             uses $a for the width, $b for the precision, and $c as the value to format; while:
3873 :               printf '<%*1$.*s>', $a, $b;
3875 :             would use $a for the width and precision, and $b as the value to format.
3918 :                $atime,$mtime,$ctime,$blksize,$blocks)
4060 :                 $search .= "++\$seen{\$ARGV} if /\\b$word\\b/;\n";
4209 :         Perl will attempt to flush all files opened for output before any operation that may do a fork, but this may not be supported on some platforms (see perlport). To be safe, you may need to set $| ($AUTOFLUSH in English) or call the "autoflush()" method of "IO::Handle" on any open handles.
4422 :             ($a, $b, undef, $c) = &foo;       # Ignore third value returned
4486 :             unshift(@ARGV, '-e') unless $ARGV[0] =~ /^-/;
4568 :             $atime = $mtime = time;
4569 :             utime $atime, $mtime, @ARGV;
perldsc.pod
10 :                     $AoA[$x][$y][$z] =
45 :         $array[7][12]                       # array of arrays
46 :         $array[7]{string}                   # array of hashes
53 :         print $AoA[1][2];
58 :     That's because Perl doesn't (ever) implicitly dereference your variables. If you want to get at the thing a reference is referring to, then you have to do this yourself using either prefix typing indicators, like "${$blah}", "@{$blah}", "@{$blah[$i]}", or else postfix pointer arrows, like "$a->[3]", "$h->{fred}", or even "$ob->method()->[3]".
65 :             $AoA[$i] = @array;      # WRONG!
79 :             $AoA[$i] = \@array;     # WRONG!
105 :             $AoA[$i] = [ @array ];
114 :             @{$AoA[$i]} = @array;
117 :     Is it the same? Well, maybe so--and maybe not. The subtle difference is that when you assign something in square brackets, you know for sure it's always a brand new reference with a new *copy* of the data. Something else could be going on in this new case with the "@{$AoA[$i]}" dereference on the left-hand-side of the assignment. It all depends on whether $AoA[$i] had been undefined to start with, or whether it already contained a reference. If you had already populated @AoA with references, as in
119 :         $AoA[3] = \@another_array;
123 :         @{$AoA[3]} = @array;
133 :             $AoA[$i] = \@array;
140 :         $AoA[$i] = [ @array ];      # usually best
141 :         $AoA[$i] = \@array;         # perilous; just how my() was that array?
142 :         @{ $AoA[$i] } = @array;     # way too tricky for most programmers
145 :     Speaking of things like "@{$AoA[$i]}", the following are actually the same thing:
147 :         $aref->[2][2]       # clear
148 :         $$aref[2][2]        # confusing
152 :     The seemingly equivalent construct in Perl, $$aref[$i] first does the deref of $aref, making it take $aref as a reference to an array, and then dereference that, and finally tell you the *i'th* value of the array pointed to by $AoA. If you wanted the C notion, you'd have to write "${$AoA[$i]}" to force the $AoA[$i] to get evaluated first before the leading "$" dereferencer.
162 :         my $aref = [
168 :         print $aref[2][2];
172 :         print $aref->[2][2]
175 :     You can use the debugger's "x" command to dump out complex data structures. For example, given the assignment to $AoA above, here's the debugger output:
177 :         DB<1> x $AoA
178 :         $AoA = ARRAY(0x13b5a0)
215 :          $AoA[$i] = [ somefunc($i) ];
221 :          $AoA[$i] = [ @tmp ];
225 :      push @{ $AoA[0] }, "wilma", "betty";
229 :      $AoA[0][0] = "Fred";
232 :      $AoA[1][1] =~ s/(\w)/\u$1/;
235 :      for $aref ( @AoA ) {
236 :          print "\t [ @$aref ],\n";
241 :          print "\t [ @{$AoA[$i]} ],\n";
246 :          for $j ( 0 .. $#{ $AoA[$i] } ) {
247 :              print "elt $i $j is $AoA[$i][$j]\n";
311 :      foreach $family ( sort { @{$HoA{$b}} <=> @{$HoA{$a}} } keys %HoA ) {
317 :                                 @{$HoA{$b}} <=> @{$HoA{$a}}
319 :                                         $a cmp $b
376 :      $AoH[0]{pet} = "dino";
377 :      $AoH[2]{pet} = "santa's little helper";
381 :      $AoH[0]{lead} = "fred";
384 :      $AoH[1]{lead} =~ s/(\w)/\u$1/;
398 :          for $role ( keys %{ $AoH[$i] } ) {
399 :              print "$role=$AoH[$i]{$role} ";
406 :          for $role ( keys %{ $AoH[$i] } ) {
407 :              print "elt $i $role is $AoH[$i]{$role}\n";
502 :      foreach $family ( sort { keys %{$HoH{$b}} <=> keys %{$HoH{$a}} } keys %HoH ) {
515 :      foreach $family ( sort { keys %{ $HoH{$b} } <=> keys %{ $HoH{$a} } } keys %HoH ) {
518 :          for $role ( sort { $rank{$a} <=> $rank{$b} }  keys %{ $HoH{$family} } ) {
545 :          $answer = $rec->{THATCODE}->($arg);
546 :          $answer = $rec->{THISCODE}->($arg1, $arg2);
perlop.pod
5 :     In Perl, the operator determines what operation is performed, independent of the type of the operands. For example "$a + $b" is always a numeric addition, and if $a or $b do not contain numbers, an attempt is made to convert them to numbers first.
7 :     This is in contrast to many other dynamic languages, where the operation is determined by the type of the first argument. It also means that Perl has two versions of some operators, one for numeric and one for string comparison. For example "$a == $b" compares two numbers for equality, and "$a eq $b" compares two strings.
154 :     Binary "%" is the modulo operator, which computes the division remainder of its first argument with respect to its second argument. Given integer operands $a and $b: If $b is positive, then "$a % $b" is $a minus the largest multiple of $b less than or equal to $a. If $b is negative, then "$a % $b" is $a minus the smallest multiple of $b that is not less than $a (that is, the result will be less than or equal to zero). If the operands $a and $b are floating point values and the absolute value of $b (that is "abs($b)") is less than "(UV_MAX + 1)", only the integer portion of $a and $b will be used in the operation (Note: here "UV_MAX" means the maximum of the unsigned integer type). If the absolute value of the right operand ("abs($b)") is greater than or equal to "(UV_MAX + 1)", "%" computes the floating-point remainder $r in the equation "($r = $a - $i*$b)" where $i is a certain integer that makes $r have the same sign as the right operand $b (not as the left operand $a like C function "fmod()") and the absolute value less than that of $b. Note that when "use integer" is in scope, "%" gives you direct access to the modulo operator as implemented by your C compiler. This operator is not as well defined for negative operands, but it will execute faster.
241 :         $ perl -le '$a = "NaN"; print "No NaN support here" if $a == $a'
242 :         $ perl -le '$a = "NaN"; print "NaN support here" if $a != $a'
498 :     Although it has no direct equivalent in C, Perl's "//" operator is related to its C-style or. In fact, it's exactly the same as "||", except that it tests the left hand side's definedness instead of its truth. Thus, "EXPR1 // EXPR2" returns the value of "EXPR1" if it's defined, otherwise, the value of "EXPR2" is returned. ("EXPR1" is evaluated in scalar context, "EXPR2" in the context of "//" itself). Usually, this is the same result as "defined(EXPR1) ? EXPR1 : EXPR2" (except that the ternary-operator form can be used as a lvalue, while "EXPR1 // EXPR2" cannot). This is very useful for providing default values for variables. If you actually want to test if at least one of $a and $b is defined, use "defined($a // $b)".
640 :         $a = $ok ? $b : $c;  # get a scalar
642 :         $a = $ok ? @b : @c;  # oops, that's just a count!
646 :         ($a_or_b ? $a : $b) = $c;
650 :         $a % 2 ? $a += 10 : $a += 2
654 :         (($a % 2) ? ($a += 10) : $a) += 2
658 :         ($a % 2) ? ($a += 10) : ($a += 2)
662 :         $a += ($a % 2) ? 10 : 2;
669 :         $a += 2;
673 :         $a = $a + 2;
695 :         ($a += 2) *= 3;
699 :         $a += 2;
700 :         $a *= 3;
766 :         $a = $b or $c;              # bug: this is wrong
767 :         ($a = $b) or $c;            # really means this
768 :         $a = $b || $c;              # better written this way
817 :         $s = q{ if($a eq "}") ... }; # WRONG
928 :     For constructs that do interpolate, variables beginning with ""$"" or ""@"" are interpolated. Subscripted variables such as $a[3] or "$href->{key}[0]" are also interpolated, as are array and hash slices. But method calls such as "$obj->meth" are not.
1044 :             Note that it's possible to confuse Perl into thinking "//" (the empty regex) is really "//" (the defined-or operator). Perl is usually pretty good about this, but some pathological cases might trigger this, such as "$a///" (is that "($a) / (//)" or "$a // /"?) and "print $fh //" ("print $fh(//" or "print($fh //"?). In all of these examples, Perl will assume you meant defined-or. If you meant the empty regex, just use parentheses or spaces to disambiguate, or even prefix the empty regex with an "m" (so "//" becomes "m//").
1061 :              $arg = shift;
1063 :                 print if /$arg/o; # compile only once (no longer needed!)
1242 :                 $a = s/abc/def/r;           # $a is 'def123xyz' and
1347 :         Perl will attempt to flush all files opened for output before starting the child process, but this may not be supported on some platforms (see perlport). To be safe, you may need to set $| ($AUTOFLUSH in English) or call the "autoflush()" method of "IO::Handle" on any open handles.
1403 :             $ARGV[1] =~ tr/A-Z/a-z/;    # canonicalize to lower case ASCII
1628 :             Code blocks such as "(?{BLOCK})" are handled by temporarily passing control back to the perl parser, in a similar way that an interpolated array subscript expression such as "foo$array[1+f("[xyz")]bar" would be.
1632 :             Interpolation in patterns has several quirks: $|, $(, $), "@+" and "@-" are not interpolated, and constructs $var[SOMETHING] are voted (by several different estimators) to be either an array element or $var followed by an RE alternative. This is where the notation "${arr[$bar]}" comes handy: "/${arr[0-9]}/" is interpreted as array element -9, not as a regular expression from the variable $arr followed by a digit, which would be the interpretation of "/$arr[0-9]/". Since voting among different estimators may occur, the result is not predictable.
1698 :     The null filehandle <> is special: it can be used to emulate the behavior of sed and awk, and any other Unix filter program that takes a list of filenames, doing the same to each line of input from all of them. Input from <> comes either from standard input, or from each file listed on the command line. Here's how it works: the first time <> is evaluated, the @ARGV array is checked, and if it is empty, $ARGV[0] is set to "-", which when opened gives you standard input. The @ARGV array is then processed as a list of filenames. The loop
1707 :         while ($ARGV = shift) {
1708 :             open(ARGV, $ARGV);
1714 :     except that it isn't so cumbersome to say, and will actually work. It really does shift the @ARGV array and put the current filename into the $ARGV variable. It also uses filehandle *ARGV* internally. <> is just a synonym for <ARGV>, which is magical. (The pseudo code above doesn't work because it treats <ARGV> as non-magical.)
1736 :         while ($_ = $ARGV[0], /^-/) {
1883 :             $a = 3/22;
1885 :             say "a/b is ", $a/$b;
1886 :             say "a*b is ", $a*$b;
perllol.pod
8 :     An array of an array is just a regular old array @AoA that you can get at with two subscripts, like $AoA[3][2]. Here's a declaration of the array:
18 :         say $AoA[2][1];
32 :     Notice that the outer bracket type has changed, and so our access syntax has also changed. That's because unlike C, in perl you can't freely interchange arrays and references thereto. $ref_to_AoA is a reference to an array, whereas @AoA is an array proper. Likewise, $AoA[2] is not an array, but an array ref. So how come you can write these:
34 :         $AoA[2][2]
39 :         $AoA[2]->[2]
57 :             $AoA[$i] = [ somefunc($i) ];
64 :             $AoA[$i] = [ @tmp ];
69 :         $AoA[$i] = @tmp;   # WRONG!
93 :             $AoA[$i] = [ split " ", $line ];
100 :             $AoA[$i] = [ split " ", <> ];
107 :             $AoA[$i] = [ split " ", scalar(<>) ];
120 :                 $AoA[$x][$y] = func($x, $y);
125 :             $AoA[$x][20] += func2($x);
133 :         push @{ $AoA[0] }, "wilma", "betty";   # explicit deref
137 :         push $AoA[0], "wilma", "betty";        # implicit deref
141 :     The reason I said "in this instance" is because that *only* works because $AoA[0] already held an array reference. If you try that on an undefined variable, you'll take an exception. That's because the implicit derefererence will never autovivify an undefined variable the way "@{ }" always will:
143 :         my $aref = undef;
144 :         push $aref,  qw(some more values);  # WRONG!
145 :         push @$aref, qw(a few more);        # ok
164 :         print $AoA[0][0];
172 :         for $aref ( @AoA ) {
173 :             say "\t [ @$aref ],";
179 :             say "\t elt $i is [ @{$AoA[$i]} ],";
185 :             for $j ( 0 .. $#{$AoA[$i]} ) {
186 :                 say "elt $i $j is $AoA[$i][$j]";
193 :             $aref = $AoA[$i];
194 :             for $j ( 0 .. $#{$aref} ) {
195 :                 say "elt $i $j is $AoA[$i][$j]";
202 :             $aref = $AoA[$i];
203 :             $n = @$aref - 1;
205 :                 say "elt $i $j is $AoA[$i][$j]";
229 :         push $AoA[0], "wilma", "betty";
262 :             push @part, $AoA[$x][$y];
267 :         @part = @{$AoA[4]}[7..12];
271 :         @part = @{ $AoA[4] } [ 7..12 ];
280 :                 $newAoA[$x - $startx][$y - $starty] = $AoA[$x][$y];
287 :             push @newAoA, [ @{ $AoA[$x] } [ 7..12 ] ];
292 :         @newAoA = map { [ @{ $AoA[$_] } [ 7..12 ] ] } 4 .. 8;
perlsub.pod
221 :         my $auto_id = 0;
222 :         sub foo ($thing, $id = $auto_id++) {
318 :         $arg = "fred";        # "global" variable
320 :         print "$arg thinks the root is $n\n";
324 :             my $arg = shift;  # name doesn't matter
325 :             $arg **= 1/3;
326 :             return $arg;
367 :         if ((my $answer = <STDIN>) =~ /^yes$/i) {
369 :         } elsif ($answer =~ /^no$/i) {
372 :             chomp $answer;
373 :             die "'$answer' is neither 'yes' nor 'no'";
376 :     the scope of $answer extends from its declaration through the rest of that conditional, including any "elsif" and "else" clauses, but not beyond it. See "Simple Statements" in perlsyn for information on the scope of variables in statements with modifiers.
546 :              local($ary[5]) = 6;
572 :     You can use the "delete local $array[$idx]" and "delete local $hash{key}" constructs to delete a composite type entry for the current block and restore it when it ends. They return the array/hash value before the localization, which means that they are respectively equivalent to
575 :             my $val = $array[$idx];
576 :             local  $array[$idx];
577 :             delete $array[$idx];
598 :          my $a = delete local $hash{a};
599 :          # $a is [ 7, 8, 9 ]
603 :           my @nums = delete local @$a[0, 2]
605 :           # $a is [ undef, 8 ]
607 :           $a[0] = 999; # will be erased when the scope ends
609 :          # $a is back to [ 7, 8, 9 ]
805 :             my $aref;
807 :             foreach $aref ( @_ ) {
808 :                 push @retlist, pop @$aref;
838 :         ($aref, $bref) = func(\@c, \@d);
839 :         print "@$aref has more than @$bref\n";
908 :        sub myreverse (@)       myreverse $a, $b, $c
909 :        sub myjoin ($@)         myjoin ":", $a, $b, $c
915 :        sub mygrep (&@)         mygrep { /foo/ } $a, $b, $c
949 :             my $aref = shift;
950 :             die "Not an array or arrayref" unless ref $aref eq 'ARRAY';
951 :             push @$aref, @_;
967 :         mygetprotobynumber $a > $b; # parsed as mygetprotobynumber($a > $b)
1193 :     If you call a subroutine that is undefined, you would ordinarily get an immediate, fatal error complaining that the subroutine doesn't exist. (Likewise for subroutines being used as methods, when the method doesn't exist in any base class of the class's package.) However, if an "AUTOLOAD" subroutine is defined in the package or packages used to locate the original subroutine, then that "AUTOLOAD" subroutine is called with the arguments that would have been passed to the original subroutine. The fully qualified name of the original subroutine magically appears in the global $AUTOLOAD variable of the same package as the "AUTOLOAD" routine. The name is not passed as an ordinary argument because, er, well, just because, that's why. (As an exception, a method call to a nonexistent "import" or "unimport" method is just skipped instead. Also, if the AUTOLOAD subroutine is an XSUB, there are other ways to retrieve the subroutine name. See "Autoloading with XSUBs" in perlguts for details.)
1198 :             my $program = $AUTOLOAD;
perlref.pod
26 :             $arrayref  = \@ARGV;
35 :             $arrayref = [1, 2, ['a', 'b', 'c']];
37 :         Here we've created a reference to an anonymous array of three elements whose final element is itself a reference to another anonymous array of three elements. (The multidimensional syntax described later can be used to access this. For example, after the above, "$arrayref->[2][1]" would have the value "b".)
41 :             @list = (\$a, \@b, \%c);
42 :             @list = \($a, @b, %c);      # same thing!
126 :             $arrayref  = *ARGV{ARRAY};
165 :             push(@$arrayref, $filename);
166 :             $$arrayref[0] = "January";
171 :         It's important to understand that we are specifically *not* dereferencing $arrayref[0] or $hashref{"KEY"} there. The dereference of the scalar variable happens *before* it does any key lookups. Anything more complicated than a simple scalar variable must use methods 2 or 3 below. However, a "simple scalar" includes an identifier that itself uses method 1 recursively. Therefore, the following prints "howdy".
179 :             push(@{$arrayref}, $filename);
180 :             ${$arrayref}[0] = "January";
200 :             $arrayref->[0] = "January";   # Array element
204 :         The left side of the arrow can be any expression returning a reference, including a previous dereference. Note that $array[$x] is *not* the same thing as "$array->[$x]" here:
206 :             $array[$x]->{"foo"}->[0] = "January";
208 :         This is one of the cases we mentioned earlier in which references could spring into existence when in an lvalue context. Before this statement, $array[$x] may have been undefined. If so, it's automatically defined with a hash reference so that we can look up "{"foo"}" in it. Likewise "$array[$x]->{"foo"}" will automatically get defined with an array reference so that we can look up "[0]" in it. This process is called *autovivification*.
212 :             $array[$x]{"foo"}[0] = "January";
334 :         $array{ "aaa" }{ "bbb" }{ "ccc" }
338 :         $array{ aaa }{ bbb }{ ccc }
342 :         $array{ shift }
346 :         $array{ shift() }
347 :         $array{ +shift }
348 :         $array{ shift @_ }
405 :         $x{ \$a } = $a;
432 :       $aref->@*;  # same as  @{ $aref }
433 :       $aref->$#*; # same as $#{ $aref }
449 :       $aref->@[ ... ];  # same as @$aref[ ... ]
454 :       $aref->%[ ... ];  # same as %$aref[ ... ]
perldiag.pod
70 :             open(OUT,">$ARGV[0]") or die "Can't write to $ARGV[0]: $!";
626 :         (F) The global variables $a and $b are reserved for sort comparisons. You mentioned $a or $b in the same line as the <=> or cmp operator, and the variable had earlier been declared as a lexical variable. Either qualify the sort variable with the package name, or rename the lexical variable.
1141 :         (F) Perl limits identifiers (names for variables, functions, etc.) to about 250 characters for simple names, and somewhat more for compound names (like $A::B). You've exceeded Perl's limits. Future versions of Perl are likely to eliminate these arbitrary limitations.
1219 :         (F) Currently the implementation of "state" only permits the initialization of scalar variables in scalar context. Re-write "state ($a) = 42" as "state $a = 42" to change from list to scalar context. Constructions such as "state (@a) = foo()" will be supported in a future perl release.
1486 :         (F) In a subroutine signature, you wrote something like "$a = undef, $b", making an earlier parameter optional and a later one mandatory. Parameters are filled from left to right, so it's impossible for the caller to omit an earlier one and pass a later one. If you want to act as if the parameters are filled from right to left, declare the rightmost optional and then shuffle the parameters around in the subroutine's body.
1630 :         (W syntax) The package variables $a and $b are used for sort comparisons. You used $a or $b in as an operand to the "<=>" or "cmp" operator inside a sort comparison block, and the variable had earlier been declared as a lexical variable. Either qualify the sort variable with the package name, or rename the lexical variable.
1926 :         (F) In a subroutine signature, you wrote something like "$a =", making a named optional parameter without a default value. A nameless optional parameter is permitted to have no default value, but a named one must have a specific default. You probably want "$a = undef".
1948 :         (F) You can't allocate more than 2^31+"small amount" bytes. This error is most likely to be caused by a typo in the Perl program. e.g., $arr[time] instead of $arr[$time].
2262 :             sub { return $a or $b; }
2266 :             sub { (return $a) or $b; }
2270 :             sub { return $a; }
2301 :             $aref->@*;
2302 :             $aref->@[@indices];
2653 :         (W syntax) The package variables $a and $b are used for sort comparisons. You used $a or $b in as an operand to the "<=>" or "cmp" operator inside a sort comparison block, and the variable had earlier been declared as a lexical variable. Either qualify the sort variable with the package name, or rename the lexical variable.
3024 :          if ($a =~ /foo/and $bar == 3) { ... }
3028 :          if ($a =~ /foo/ and $bar == 3) { ... }
3261 :             $array = (1,2);
3265 :             $array = [1,2];
3374 :         If you really do mean it, explicitly numify your reference, like so: $array[0+$ref]. This warning is not given for overloaded objects, however, because you can overload the numification and stringification operators and then you presumably know what you are doing.
3431 :             sub { my $a; sub f { $a } }
3433 :         At the time that f is created, it can't capture the current value of $a, since the anonymous subroutine hasn't been created yet. Conversely, the following won't give a warning since the anonymous subroutine has by now been created and is live:
3435 :             sub { my $a; eval 'sub f { $a }' }->();
3440 :                 my $a;
3441 :                 sub { eval '$a' }
3445 :         Here, when the '$a' in the eval is being compiled, f() is not currently being executed, so its $a is not available for capture.
perlreftut.pod
49 :         $aref = \@array;         # $aref now holds a reference to @array
53 :     Once the reference is stored in a variable like $aref or $href, you can copy it or store it just the same as any other scalar value:
55 :         $xy = $aref;             # $xy now holds a reference to @array
65 :         $aref = [ 1, "foo", undef, 13 ];
66 :         # $aref now holds a reference to an array
74 :             $aref = [ 1, 2, 3 ];
78 :             $aref = \@array;
88 :     You can always use an array reference, in curly braces, in place of the name of an array. For example, "@{$aref}" instead of @array.
94 :             @a              @{$aref}                An array
95 :             reverse @a      reverse @{$aref}        Reverse the array
96 :             $a[3]           ${$aref}[3]             An element of the array
97 :             $a[3] = 17;     ${$aref}[3] = 17        Assigning an element
99 :     On each line are two expressions that do the same thing. The left-hand versions operate on the array @a. The right-hand versions operate on the array that is referred to by $aref. Once they find the array they're operating on, both versions do the same things to the arrays.
116 :             for my $element (@{$aref}) {
135 :     "${$aref}[3]" is too hard to read, so you can write "$aref->[3]" instead.
139 :     If $aref holds a reference to an array, then "$aref->[3]" is the fourth element of the array. Don't confuse this with $aref[3], which is the fourth element of a totally different array, one deceptively named @aref. $aref and @aref are unrelated the same way that $item and @item are.
157 :     $a[1] is one of these references. It refers to an array, the array containing "(4, 5, 6)", and because it is a reference to an array, Use Rule 2 says that we can write $a[1]->[2] to get the third element from that array. $a[1]->[2] is the 6. Similarly, $a[0]->[1] is the 2. What we have here is like a two-dimensional array; you can write $a[ROW]->[COLUMN] to get or set the element in any row and any column of the array.
164 :     Instead of $a[1]->[2], we can write $a[1][2]; it means the same thing. Instead of "$a[0]->[1] = 23", we can write "$a[0][1] = 23"; it means the same thing.
168 :     You can see why the arrows are important. Without them, we would have had to write "${$a[1]}[2]" instead of $a[1][2]. For three-dimensional arrays, they let us write $x[2][3][5] instead of the unreadable "${${$x[2]}[3]}[5]".
258 :     *   In Use Rule 1, you can omit the curly brackets whenever the thing inside them is an atomic scalar variable like $aref. For example, @$aref is the same as "@{$aref}", and $$aref[1] is the same as "${$aref}[1]". If you're just starting out, you may want to adopt the habit of always including the curly brackets.
262 :                 $aref2 = $aref1;
264 :         You get two references to the same array. If you modify "$aref1->[23]" and then look at "$aref2->[23]" you'll see the change.
268 :                 $aref2 = [@{$aref1}];
270 :         This uses "[...]" notation to create a new anonymous array, and $aref2 is assigned a reference to the new array. The new array is initialized with the contents of the array referred to by $aref1.
perlebcdic.pod
73 :        # $a is in EBCDIC code points
74 :        from_to($a, $ebcdic{ord '^'}, 'latin1');
75 :        # $a is ISO 8859-1 code points
83 :        # $a is ISO 8859-1 code points
84 :        from_to($a, 'latin1', $ebcdic{ord '^'});
85 :        # $a is in EBCDIC code points
441 :          -e '          sort{$a->[1] <=> $b->[1]}' \
452 :         -e '          sort{$a->[1] <=> $b->[1]}' \
463 :          -e '          sort{$a->[1] <=> $b->[1]}' \
528 :         my $ebcdic_string = $ascii_string;
533 :         my $ascii_string = $ebcdic_string;
534 :         eval '$ascii_string =~ tr/' . $cp_037 . '/\000-\377/';
546 :         $ascii_data = `echo '$ebcdic_data'| iconv -f IBM-1047 -t ISO8859-1`
551 :         $ebcdic_data = `echo '$ascii_data'| iconv -f ISO8859-1 -t IBM-1047`
806 :         $url =~ s/%([0-9a-fA-F]{2})/pack("c",$a2e_1047[hex($1)])/ge;
842 :         $all_byte_chrs = '';
843 :         for (0..255) { $all_byte_chrs .= chr($_); }
844 :         $uuencode_byte_chrs = pack('u', $all_byte_chrs);
846 :         M``$"`P0%!@<("0H+#`T.#Q`1$A,4%187&!D:&QP='A\@(2(C)"4F)R@I*BLL
857 :         if ($uudecode_byte_chrs eq $all_byte_chrs) {
908 :         $string =~ s/=([0-9A-Fa-f][0-9A-Fa-f])/chr $a2e[hex $1]/ge;
perlthrtut.pod
158 :             $a = 0;
160 :                 $a++;
161 :                 print("\$a is $a\n");
247 :         my $a :shared = 1;
253 :         print("$a\n");
255 :         sub sub1 { my $foo = $a; $a = $foo + 1; }
256 :         sub sub2 { my $bar = $a; $a = $bar + 1; }
258 :     What do you think $a will be? The answer, unfortunately, is *it depends*. Both "sub1()" and "sub2()" access the global variable $a, once to read and once to write. Depending on factors ranging from your thread implementation's scheduling algorithm to the phase of the moon, $a can be 2 or 3.
263 :         my $a :shared = 2;
266 :         my $thr1 = threads->create(sub { $b = $a; $a = $b + 1; });
267 :         my $thr2 = threads->create(sub { $c = $a; $a = $c + 1; });
271 :     Two threads both access $a. Each thread can potentially be interrupted at any point, or be executed in any order. At the end, $a could be 3 or 4, and both $b and $c could be 2 or 3.
273 :     Even "$a += 5" or "$a++" are not guaranteed to be atomic.
348 :         my $a :shared = 4;
351 :             lock($a);
358 :             lock($a);
363 :     The first thread will grab a lock on $a, then, after a pause during which the second thread has probably had time to do some work, try to grab a lock on $b. Meanwhile, the second thread grabs a lock on $b, then later tries to grab a lock on $a. The second lock attempt for both threads will block, each waiting for the other to release its lock.
367 :     There are a number of ways to handle this sort of problem. The best way is to always have all threads acquire locks in the exact same order. If, for example, you lock variables $a, $b, and $c, always lock $a before $b, and $b before $c. It's also best to hold on to locks for as short a period of time to minimize the risks of deadlock.
582 :     Since kernel threading can interrupt a thread at any time, they will uncover some of the implicit locking assumptions you may make in your program. For example, something as simple as "$a = $a + 2" can behave unpredictably with kernel threads if $a is visible to other threads, as another thread may have changed $a between the time it was fetched on the right hand side and the time the new value is stored.
perlsec.pod
39 :         $arg = shift;               # $arg is tainted
40 :         $hid = $arg . 'bar';        # $hid is also tainted
48 :         system "echo $arg";         # Insecure
49 :         system "/bin/echo", $arg;   # Considered insecure
62 :         open(FOO, "< $arg");        # OK - read-only file
63 :         open(FOO, "> $arg");        # Not OK - trying to write
65 :         open(FOO,"echo $arg|");     # Not OK
67 :             or exec 'echo', $arg;   # Also not OK
69 :         $shout = `echo $arg`;       # Insecure, $shout now tainted
71 :         unlink $data, $arg;         # Insecure
72 :         umask $arg;                 # Insecure
74 :         exec "echo $arg";           # Insecure
75 :         exec "echo", $arg;          # Insecure
76 :         exec "sh", '-c', $arg;      # Very insecure!
84 :         $bad = ($arg, 23);          # $bad will be tainted
85 :         $arg, `true`;               # Insecure (although it isn't really)
perlcall.pod
285 :             my($a, $b) = @_;
286 :             $a + $b;
352 :            my($a, $b) = @_;
353 :            ($a+$b, $a-$b);
505 :             my ($a, $b) = @_;
507 :             die "death can be fatal\n" if $a < $b;
509 :             $a - $b;
588 :             my($a,$b) = @_;
589 :             die "death can be fatal" if $a < $b;
590 :             $a - $b;
780 :         $a = Mine->new('red', 'green', 'blue');
781 :         $a->Display(1);
825 :         $a = Mine->new('red', 'green', 'blue');
826 :         call_Method($a, 'Display', 1);
848 :         $a = PrintContext;
1283 :     It is usual to pass parameters using global variables (typically $_ for one parameter, or $a and $b for two parameters) rather than via @_. (It is possible to use the @_ mechanism if you know what you're doing, though there is as yet no supported API for it. It's also inherently slower.)
perlvar.pod
32 :     $ARG
163 :                 $foo{$a,$b,$c}
167 :                 $foo{join($;, $a, $b, $c)}
171 :                 @foo{$a,$b,$c}      # a slice--note the @
175 :                 ($foo{$a},$foo{$b},$foo{$c})
183 :     $a
184 :     $b      Special package variables when using "sort()", see "sort" in perlfunc. Because of this specialness $a and $b don't need to be declared (using "use vars", or "our()") even when using the "strict 'vars'" pragma. Don't lexicalize them with "my $a" or "my $b" if you want to be able to use them in the "sort()" comparison block or function.
573 :                         my $ary = $-{$bufname};
574 :                         foreach my $idx (0..$#$ary) {
576 :                                   (defined($ary->[$idx])
577 :                                       ? "'$ary->[$idx]'"
688 :     $ARGV   Contains the name of the current file when reading from "<>".
690 :     @ARGV   The array @ARGV contains the command-line arguments intended for the script. $#ARGV is generally the number of arguments minus one, because $ARGV[0] is the first argument, *not* the program's command name itself. See "$0" for the command name.
772 :     $ACCUMULATOR
perlintro.pod
98 :          my $animal = "camel";
99 :          my $answer = 42;
105 :          print $animal;
106 :          print "The animal is $animal\n";
107 :          print "The square of $answer is ", $answer * $answer, "\n";
122 :          print $animals[0];              # prints "camel"
123 :          print $animals[1];              # prints "llama"
339 :      $a += 1;        # same as $a = $a + 1
340 :      $a -= 1;        # same as $a = $a - 1
341 :      $a .= "\n";     # same as $a = $a . "\n";
378 :          if ($a =~ /foo/) { ... }  # true if $a contains "foo"
384 :          $a =~ s/foo/bar/;         # replaces foo with bar in $a
385 :          $a =~ s/foo/bar/g;        # replaces ALL INSTANCES of foo with bar
386 :                                    # in $a
perlsyn.pod
16 :         if ($a) {}
20 :         undef $a;
21 :         $a++;
216 :             print "$ARGV $.: $_";
316 :                 if ($ary1[$i] > $ary2[$j]) {
319 :                 $ary1[$i] += $ary2[$j];
343 :             if (/^abc/) { $abc = 1; last SWITCH; }
353 :             if (/^abc/) { $abc = 1; last SWITCH; }
376 :             when (/^abc/) { $abc = 1 }
386 :             when (/^abc/) { $abc = 1 }
396 :             $abc = 1 when /^abc/;
406 :             $abc = 1 when /^abc/;
511 :         $a=3;
515 :         print "got $a\n";
perlperf.pod
640 :             $a->[3] cmp $b->[3]
642 :             $a->[2] cmp $b->[2]
644 :             $a->[0] cmp $b->[0]
646 :             $a->[1] cmp $b->[1]
648 :             $a->[4] cmp $b->[4]
690 :                 $a->[4] cmp $b->[4]
692 :                 $a->[3] cmp $b->[3]
694 :                 $a->[1] cmp $b->[1]
696 :                 $a->[2] cmp $b->[2]
698 :                 $a->[5] cmp $b->[5]
perlguts.pod
210 :       % ./perl -Ilib -MDevel::Peek -le '$a="12345"; $a=~s/.//; Dump($a)'
385 :         $av[0] = undef;
387 :     Unfortunately, this isn't true. In perl 5.18 and earlier, AVs use &PL_sv_undef as a marker for indicating that an array element has not yet been initialized. Thus, "exists $av[0]" would be true for the above Perl code, but false for the array generated by the XS code. In perl 5.20, storing &PL_sv_undef will create a read-only element, because the scalar &PL_sv_undef itself is stored, not a copy.
1020 :     If an AUTOLOAD routine is an XSUB, as with Perl subroutines, Perl puts the fully-qualified name of the autoloaded subroutine in the $AUTOLOAD variable of the XSUB's package.
1031 :     Note: Setting $AUTOLOAD stopped working in 5.6.1, which did not support XS AUTOLOAD subs at all. Perl 5.8.0 introduced the use of fields in the XSUB itself. Perl 5.16.0 restored the setting of $AUTOLOAD. If you need to support 5.8-5.14, use the XSUB's fields.
1146 :       $a = $b + $c;
1152 :               +             $a
1158 :          $b ---> $c ---> + ---> $a ---> assign-to
1160 :     But with the actual compile tree for "$a = $b + $c" it is different: some nodes *optimized away*. As a corollary, though the actual tree contains more nodes than our simplified example, the execution order is the same as in our example.
perlfilter.pod
50 :         3: $a = TRUE;
51 :         4: print "a = $a\n";
72 :         $a = 1;
73 :         print "a = $a\n";
80 :         4: $a = TRUE;
81 :         5: print "a = $a\n";
128 :         $a = 1;
129 :         print "XYZ a = $a\n";
180 :         my $in = $ARGV[0];
perlrun.pod
308 :                  if ($ARGV ne $oldargv) {
310 :                          $backup = $ARGV . $extension;
313 :                          ($backup = $extension) =~ s/\*/$ARGV/g;
315 :                      rename($ARGV, $backup);
316 :                      open(ARGVOUT, ">$ARGV");
318 :                      $oldargv = $ARGV;
327 :          except that the -i form doesn't need to compare $ARGV to $oldargv to know when the filename has changed. It does, however, use ARGVOUT for the selected filehandle. Note that STDOUT is restored as the default output filehandle after the loop.
433 :                  & eval 'exec /usr/bin/perl -wS $0 $argv:q'
perlembed.pod
224 :          /** Treat $a as an integer **/
225 :          eval_pv("$a = 3; $a **= 2", TRUE);
228 :          /** Treat $a as a float **/
229 :          eval_pv("$a = 3.14; $a **= 2", TRUE);
232 :          /** Treat $a as a string **/
234 :            "$a = 'rekcaH lreP rehtonA tsuJ'; $a = reverse($a);", TRUE);
468 :             my ($a, $b) = @_;
469 :             return $a ** $b;
perlpod.pod
281 :         C<$a E<lt>=E<gt> $b>
283 :     This will produce: ""$a <=> $b""
287 :         C<< $a <=> $b >>
291 :         C<<< $a <=> $b >>>
292 :         C<<<<  $a <=> $b     >>>>
296 :         C<$a E<lt>=E<gt> $b>
300 :         C<< $a E<lt>=E<gt> $b >>
perlinterp.pod
222 :     Line 13 manipulates the flags; since we've changed the PV, any IV or NV values will no longer be valid: if we have "$a=10; $a.="6";" we don't want to use the old IV of 10. "SvPOK_only_utf8" is a special UTF-8-aware version of "SvPOK_only", a macro which turns off the IOK and NOK flags and turns on POK. The final "SvTAINT" is a macro which launders tainted data if taint mode is turned on.
235 :     Let's have a look at how Perl sees "$a = $b + $c":
237 :          % perl -MO=Terse -e '$a=$b+$c'
278 :                             $a   +
284 :          % perl -MO=Terse,exec -e '$a=$b+$c'
294 :     This probably makes more sense for a human: enter a block, start a statement. Get the values of $b and $c, and add them together. Find $a, and assign one to the other. Then leave.
296 :     The way Perl builds up these op trees in the parsing process can be unravelled by examining perly.y, the YACC grammar. Let's take the piece we need to construct the tree for "$a = $b + $c"
perlpacktut.pod
225 :        my( $ip, $cs, $flags, $ax, $bx, $cd, $dx, $si, $di, $bp, $ds, $es ) =
230 :        my( $fl, $fh, $al, $ah, $bl, $bh, $cl, $ch, $dl, $dh ) =
237 :            $ax,$al,$ah, $bx,$bl,$bh, $cx,$cl,$ch, $dx,$dl,$dh, 
298 :        ($carry, undef, $parity, undef, $auxcarry, undef, $zero, $sign,
352 :        my $alefbet = pack( 'U*', 0x05d0..0x05ea );
485 :        my( $addr, $type, $data ) = unpack( "x n C X4 C x3 /a", $bin );
711 :         my $advice = pack( 'all u can in a van' );
perlretut.pod
194 :        /[\$x]at/;  # matches '$at' or 'xat'
423 :         $a99a = '([a-z])(\d)\g2\g1';   # matches a11a, g22g, x33x, etc.
428 :         if ($line =~ /^(\w+)=$a99a$/){   # unexpected behavior!
434 :     But this doesn't match, at least not the way one might expect. Only after inserting the interpolated $a99a and looking at the resulting full text of the regexp is it obvious that the backreferences have backfired. The subexpression "(\w+)" has snatched number 1 and demoted the groups in $a99a by one rank. This can be avoided by using relative backreferences:
436 :         $a99a = '([a-z])(\d)\g{-1}\g{-2}';  # safe for being interpolated
968 :             foreach (sort {$chars{$b} <=> $chars{$a}} keys %chars);
perlre.pod
408 :     Braces are required in referring to named capture groups, but are optional for absolute or relative numbered ones. Braces are safer when creating a regex by concatenating smaller strings. For example if you have "qr/$a$b/", and $a contained "\g1", and $b contained "37", you would get "/\g137/" which is probably not what you intended.
438 :         $a = '(.)\1';        # Creates problems when concatenated.
647 :             "abc$array[ 1 + f('[') + g()]def"
719 :           /the (\S+)(?{ $color = $^N }) (\S+)(?{ $animal = $^N })/i;
720 :           print "color = $color, animal = $animal\n";
951 :     NOTE: $REGERROR and $REGMARK are not magic variables like $1 and most other regex-related variables. They are not local to a scope, nor readonly, but instead are volatile package variables similar to $AUTOLOAD. Use "local" to localize changes to them to a specific scope if necessary.
perllocale.pod
311 :         my ($abday_1, $yesstr, $nostr)
314 :         print "$abday_1? [$yesstr/$nostr] ";
395 :      $a = " $n"; # Locale-dependent conversion to string
573 :      my $a = 1.2;
574 :      print eval "$a + 1.5";
583 :      print eval "no locale; $a + 1.5";
perlobj.pod
522 :     The fully qualified method name that was called is available in the $AUTOLOAD package global for your class. Since this is a global, if you want to refer to do it without a package name prefix under "strict 'vars'", you need to declare it.
526 :       our $AUTOLOAD;
531 :           my $called =  $AUTOLOAD =~ s/.*:://r;
543 :     Without the "our $AUTOLOAD" declaration, this code will not compile under the strict pragma.
560 :     If you define an "AUTOLOAD" in your class, then Perl will call your "AUTOLOAD" to handle the "DESTROY" method. You can prevent this by defining an empty "DESTROY", like we did in the autoloading example. You can also check the value of $AUTOLOAD and return without doing anything when called to handle "DESTROY".
perltie.pod
133 :         $array[0] = 'cat';  # ok.
134 :         $array[1] = 'dogs'; # exception, length('dogs') > 3.
531 :                 my $a = keys %{$self->{LIST}};          # reset each() iterator
681 :         $a = 4; $b = 6;
682 :         print FOO $a, " plus ", $b, " equals ", $a + $b, "\n";
perldata.pod
305 :         ($a, $b, $c) = (1, 2, 3);
332 :         ($a, $b, @rest) = split;
333 :         my($a, $b, %rest) = @_;
421 :         $foo{$a,$b,$c}
425 :         $foo{join($;, $a, $b, $c)}
perlpodspec.pod
209 :           B<example: C<$a E<lt>=E<gt> $b>>
211 :           B<example: C<< $a <=> $b >>>
213 :           B<example: C<< $a E<lt>=E<gt> $b >>>
215 :           B<<< example: C<< $a E<lt>=E<gt> $b >> >>>
perluniintro.pod
96 :         my $arabic_alef = "\N{ARABIC LETTER ALEF}";
320 :             $a = "ab\x80c";
322 :             print "$a = $b\n";
324 :         the output string will be UTF-8-encoded "ab\x80c = \x{100}\n", but $a will stay byte-encoded.
perlipc.pod
102 :         my $ALARM_EXCEPTION = "alarm clock restart";
104 :             local $SIG{ALRM} = sub { die $ALARM_EXCEPTION };
110 :         if ($@ && $@ !~ quotemeta($ALARM_EXCEPTION)) { die }
573 :     One of the major problems with ancient, antemillennial socket code in Perl was that it used hard-coded values for some of the constants, which severely hurt portability. If you ever see code that does anything like explicitly setting "$AF_INET = 2", you know you're in for big trouble. An immeasurably superior approach is to use the "Socket" module, which more reliably grants access to the various constants and functions you'll need.
perldebtut.pod
335 :             my $arg = $ARGV[0] || '-c20';
337 :             if ($arg =~ /^\-(c|f)((\-|\+)*\d+(\.\d+)*)$/) {
390 :             main::(temp:4): my $arg = $ARGV[0] || '-c100';
perlhacktips.pod
449 :     One way to get around this macro hell is to use the dumping functions in dump.c; these work a little like an internal Devel::Peek, but they also cover OPs and other structures that you can't get at from Perl. Let's take an example. We'll use the "$a = $b + $c" we used before, but give it a bit of context: "$b = "6XXXX"; $c = 2.3;". Where's a good place to stop and poke around?
458 :         (gdb) run -e '$b = "6XXXX"; $c = 2.3; $a = $b + $c'
551 :         if ($a && $b && do { BEGIN { study } 1 } && $c) { ... }
perltrap.pod
57 :               FILENAME  $ARGV
91 :     *   "ARGV" must be capitalized. $ARGV[0] is C's "argv[1]", and "argv[0]" ends up in $0.
perldebguts.pod
18 :     *   Each hash "%{"_<$filename"}" contains breakpoints and actions keyed by line number. Individual entries (as opposed to the whole hash) are settable. Perl only cares about Boolean true here, although the values used by perl5db.pl have the form "$break_condition\0$action".
79 :         As previously noted, individual entries (as opposed to the whole hash) are settable. Perl only cares about Boolean true here, although the values used by perl5db.pl have the form "$break_condition\0$action".
perlgit.pod
268 :         perl -e 'my $a := 2'
272 :         .../Porting/bisect.pl -e 'my $a := 2;'
perlvms.pod
75 :     Perl follows VMS defaults and override settings in preserving (or not preserving) filename case. Case is not preserved on ODS-2 formatted volumes on any architecture. On ODS-5 volumes, filenames may be case preserved depending on process and feature settings. Perl now honors DECC$EFS_CASE_PRESERVE and DECC$ARGV_PARSE_STYLE on those systems where the CRTL supports these features. When these features are not enabled or the CRTL does not support them, Perl follows the traditional CRTL behavior of downcasing command-line arguments and returning file specifications in lower case only.
perldbmfilter.pod
71 :         my $a = $hash{"ABC"};
perlcheat.pod
11 :       list      %hash   HASH       $array[0]     $hash{'a'}
perlform.pod
241 :     For low-level access to the formatting mechanism, you may use formline() and access $^A (the $ACCUMULATOR variable) directly.
perlrequick.pod
104 :        /[\$x]at/;  # matches '$at' or 'xat'
perlrebackslash.pod
236 :     The "\g*N*" form can be equivalently written as "\g{*N*}" which avoids ambiguity when building a regex by concatenating shorter strings. Otherwise if you had a regex "qr/$a$b/", and $a contained "\g1", and $b contained "37", you would get "/\g137/" which is probably not what you intended.
perlstyle.pod
100 :             $ALL_CAPS_HERE   constants only (beware clashes with perl vars!)
<< Back to Perldoc Search