Perldoc Search: "@F" perl-5.20.1

search official POD


20 PODs, 76 LINEs found.
perlfunc.pod
396 :             chown $uid, $gid, @filenames;
1424 :             @foo = grep(!/^#/, @bar);    # weed out comments
1428 :             @foo = grep {!/^#/} @bar;    # weed out comments
3177 :                 my @fhlist = @_;
3179 :                 for my $fh (@fhlist) {
3381 :             @articles = sort @files;
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;
3483 :             @articles = sort {$b <=> $a} @files;
3487 :             @articles = sort {$FooPack::b <=> $FooPack::a} @files;
4056 :         Note that if you have to look for strings that you don't know till runtime, you can build an entire loop as a string and "eval" that to avoid recompiling all your patterns all the time. Together with undefining $/ to input entire files as one record, this can be quite fast, often faster than specialized programs like fgrep(1). The following scans a list of files (@files) for a list of words (@words), and prints out the names of those files that contain a match:
4063 :             @ARGV = @files;
perldata.pod
31 :     Every variable type has its own namespace, as do several non-variable identifiers. This means that you can, without fear of conflict, use the same name for a scalar variable, an array, or a hash--or, for that matter, for a filehandle, a directory handle, a subroutine name, a format name, or a label. This means that $foo and @foo are two different variables. It also means that $foo[1] is a part of @foo, not a part of $foo. This may seem a bit weird, but that's okay, because it is weird.
239 :     Within search patterns (which also undergo double-quotish substitution) there is an unfortunate ambiguity: Is "/$foo[bar]/" to be interpreted as "/${foo}[bar]/" (where "[bar]" is a character class for the regular expression) or as "/${foo[bar]}/" (where "[bar]" is the subscript to array @foo)? If @foo doesn't otherwise exist, then it's obviously a character class. If @foo exists, Perl takes a good guess about "[bar]", and is almost always right. If it does guess wrong, or if you're just plain paranoid, you can force the correct interpretation with curly braces as above.
250 :         @foo = ('cc', '-E', $bar);
252 :     assigns the entire list value to array @foo, but
258 :         @foo = ('cc', '-E', $bar);
259 :         $foo = @foo;                # $foo gets 3
263 :         @foo = (
281 :         (@foo,@bar,&SomeSub,%glarch)
283 :     contains all the elements of @foo followed by all the elements of @bar, followed by all the elements returned by the subroutine named SomeSub called in list context, followed by the key/value pairs of %glarch. To make a list reference that does *NOT* interpolate, see perlref.
301 :         return (pop(@foo),pop(@foo))[0];
432 :         ($him, $her)   = @folks[0,-1];              # array slice
433 :         @them          = @folks[0 .. 3];            # array slice
442 :         @folks[0, -1]  = @folks[-1, 0];
perldiag.pod
56 :         (W ambiguous) You wrote something like "@{foo}", which might be asking for the variable @foo, or it might be calling a function named foo, and dereferencing it as an array reference. If you wanted the variable, you can just write @foo. If you wanted to call the function, write "@{foo()}" ... or you could just not have a variable and a function with the same name, and save yourself a lot of trouble.
60 :         (W ambiguous) You wrote something like "${foo[2]}" (where foo represents the name of a Perl keyword), which might be looking for element number 2 of the array named @foo, in which case please write $foo[2], or you might have meant to pass an anonymous arrayref to the function named foo, and then do a scalar deref on the value it returns. If you meant that, write "${foo([2])}".
839 :             @foo[$bar, $baz, $xyzzy]
1225 :         (W syntax) In scalar context, you've used a hash key/value slice (indicated by %) to select a single element of a hash. Generally it's better to ask for a scalar value (indicated by $). The difference is that $foo{&bar} always behaves like a scalar, both in the value it returns and when evaluating its argument, while @foo{&bar} and provides a list context to its subscript, which can do weird things if you're expecting only one subscript. When called in list context, it also returns the key in addition to the value.
2293 :         (W ambiguous) You said something like '@foo' in a double-quoted string but there was no array @foo in scope at the time. If you wanted a literal @foo, then write it as \@foo; otherwise find out what happened to the array you apparently lost track of.
2474 :         (W syntax) You've used an array slice (indicated by @) to select a single element of an array. Generally it's better to ask for a scalar value (indicated by $). The difference is that $foo[&bar] always behaves like a scalar, both when assigning to it and when evaluating its argument, while @foo[&bar] behaves like a list when you assign to it, and provides a list context to its subscript, which can do weird things if you're expecting only one subscript.
2479 :         (W syntax) You've used a hash slice (indicated by @) to select a single element of a hash. Generally it's better to ask for a scalar value (indicated by $). The difference is that $foo{&bar} always behaves like a scalar, both when assigning to it and when evaluating its argument, while @foo{&bar} behaves like a list when you assign to it, and provides a list context to its subscript, which can do weird things if you're expecting only one subscript.
3289 :         (W syntax) You used the push() or unshift() function with no arguments apart from the array, like "push(@x)" or "unshift(@foo)". That won't usually have any effect on the array, so is completely useless. It's possible in principle that push(@tied_array) could have some effect if the array is tied to a class which implements a PUSH method. If so, you can write it as "push(@tied_array,())" to avoid this warning.
3406 :         (D deprecated) You tried to use an array as a reference, as in "@foo->[23]" or "@$ref->[99]". Versions of perl <= 5.6.1 used to allow this syntax, but shouldn't have. It is now deprecated, and will be removed in a future version.
perlop.pod
593 :         @foo = @foo[0 .. $#foo];        # an expensive no-op
594 :         @foo = @foo[$#foo-4 .. $#foo];  # slice last 5 items
1227 :                 @foo = map { s/this/that/r } @bar   # /r is very useful in
1626 :             However any other combinations of "\" followed by a character are not substituted but only skipped, in order to parse them as regular expressions at the following step. As "\c" is skipped at this step, "@" of "\c@" in RE is possibly treated as an array symbol (for example @foo), even though the same text in "qq//" gives interpolation of "\c@".
1787 :         @files = glob("$dir/*.[ch]");
1788 :         @files = glob($files[$i]);
1799 :         foreach $file (@filenames) {
perlsub.pod
332 :         my @FOO = <STDIN>;
489 :         local *FH;                 # localize $FH, @FH, %FH, &FH  ...
507 :         local @FOO = <STDIN>;
750 :         The global variables, like @ARGV or the punctuation variables, must be "local"ized with "local()". This block reads in /etc/motd, and splits it up into chunks separated by lines of equal signs, which are placed in @Fields.
756 :                 @Fields = split /^\s*=+\s*$/;
1013 :         func(@foo);
1016 :     Then you've just supplied an automatic "scalar" in front of their argument, which can be more than a bit surprising. The old @foo which used to hold one thing doesn't get passed in. Instead, "func()" now gets passed in a 1; that is, the number of elements in @foo. And the "split" gets called in scalar context so it starts scribbling on your @_ parameter list. Ouch!
perlrun.pod
122 :     -a   turns on autosplit mode when used with a -n or -p. An implicit split command to the @F array is done as the first thing inside the implicit while loop produced by the -n or -p.
124 :              perl -ane 'print pop(@F), "\n";'
129 :                  @F = split(' ');
130 :                  print pop(@F), "\n";
perlvar.pod
171 :                 @foo{$a,$b,$c}      # a slice--note the @
212 :     @F      The array @F contains the fields of each line read in when autosplit mode is turned on. See perlrun for the -a switch. This array is package-specific, and must be declared or given a full package name if not in package main when running under "strict 'vars'".
345 :                 @first_run = `$^X -le "print int rand 100 for 1..100"`;
perlref.pod
44 :         As a special case, "\(@foo)" returns a list of references to the contents of @foo, not a reference to @foo itself. Likewise for %foo, except that the key references are to copies (since the keys are just strings rather than full-fledged scalars).
288 :         @$name = ();                # Clears @foo
perlre.pod
521 :             @fields = split(/\b(?:a|b|c)\b/)
525 :             @fields = split(/\b(a|b|c)\b/)
perlsec.pod
78 :         @files = <*.c>;             # insecure (uses readdir() or similar)
79 :         @files = glob('*.c');       # insecure (uses readdir() or similar)
perlrequick.pod
302 :         @foo = map { s/[a-z]/X/r } qw(a b c 1 2 3);
303 :         # @foo is now qw(X X X 1 2 3)
perldsc.pod
271 :          @fields = split ' ', $rest;
272 :          $HoA{$who} = [ @fields ];
perlreftut.pod
286 :     *   You can use a string as if it were a reference. If you use the string "foo" as an array reference, it's taken to be a reference to the array @foo. This is called a *soft reference* or *symbolic reference*. The declaration "use strict 'refs'" disables this feature, which can cause all sorts of trouble if you use it by accident.
perlgit.pod
306 :       Author: Dave Mitchell <davem@fdisolutions.com>
perlintro.pod
168 :          my @fruits = keys %fruit_colors;
perlobj.pod
150 :       use parent 'File';    # sets @File::MP3::ISA = ('File');
perlsyn.pod
655 :     Another useful shortcut is that, if you use a literal array or hash as the argument to "given", it is turned into a reference. So "given(@foo)" is the same as "given(\@foo)", for example.
perlport.pod
1283 :     Abigail <abigail@foad.org>, Charles Bailey <bailey@newman.upenn.edu>, Graham Barr <gbarr@pobox.com>, Tom Christiansen <tchrist@perl.com>, Nicholas Clark <nick@ccl4.org>, Thomas Dorner <Thomas.Dorner@start.de>, Andy Dougherty <doughera@lafayette.edu>, Dominic Dunlop <domo@computer.org>, Neale Ferguson <neale@vma.tabnsw.com.au>, David J. Fiander <davidf@mks.com>, Paul Green <Paul.Green@stratus.com>, M.J.T. Guy <mjtg@cam.ac.uk>, Jarkko Hietaniemi <jhi@iki.fi>, Luther Huffman <lutherh@stratcom.com>, Nick Ing-Simmons <nick@ing-simmons.net>, Andreas J. König <a.koenig@mind.de>, Markus Laker <mlaker@contax.co.uk>, Andrew M. Langmead <aml@world.std.com>, Larry Moore <ljmoore@freespace.net>, Paul Moore <Paul.Moore@uk.origin-it.com>, Chris Nandor <pudge@pobox.com>, Matthias Neeracher <neeracher@mac.com>, Philip Newton <pne@cpan.org>, Gary Ng <71564.1743@CompuServe.COM>, Tom Phoenix <rootbeer@teleport.com>, André Pirard <A.Pirard@ulg.ac.be>, Peter Prymmer <pvhp@forte.com>, Hugo van der Sanden <hv@crypt0.demon.co.uk>, Gurusamy Sarathy <gsar@activestate.com>, Paul J. Schinder <schinder@pobox.com>, Michael G Schwern <schwern@pobox.com>, Dan Sugalski <dan@sidhe.org>, Nathan Torkington <gnat@frii.com>, John Malmberg <wb8tyw@qsl.net>
perlform.pod
94 :     If you put two contiguous tilde characters "~~" anywhere into a line, the line will be repeated until all the fields on the line are exhausted, i.e. undefined. For special (caret) text fields this will occur sooner or later, but if you use a text field of the at variety, the expression you supply had better not give the same value every time forever! ("shift(@f)" is a simple example that would work.) Don't use a regular (at) numeric field in such lines, because it will never go blank.
perlmod.pod
58 :     Would print '1', because $foo holds a reference to the *original* $bar. The one that was stuffed away by "local()" and which will be restored when the block ends. Because variables are accessed through the typeglob, you can use "*foo = *bar" to create an alias which can be localized. (But be aware that this means you can't have a separate @foo and @bar, etc.)
<< Back to Perldoc Search