summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorPeter Martini <PeterCMartini@GMail.com>2014-08-10 23:11:20 -0400
committerRafael Garcia-Suarez <rgs@consttype.org>2014-09-30 08:17:50 +0200
commit1033ba6ee622b4ae14475c6261820c9949ff012f (patch)
treee570c48740629c8aa82748e3847b87b4239e5ad9 /pod
parent157fb5a14d10ed16ffc6ebfc43d2637a016fdfce (diff)
downloadperl-1033ba6ee622b4ae14475c6261820c9949ff012f.tar.gz
Added some documentation for while(<<>>)
Diffstat (limited to 'pod')
-rw-r--r--pod/perlop.pod10
1 files changed, 9 insertions, 1 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 52eb96866f..8e279febad 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -2979,7 +2979,15 @@ it interprets special characters, so if you have a script like this:
and call it with C<perl dangerous.pl 'rm -rfv *|'>, it actually opens a
pipe, executes the C<rm> command and reads C<rm>'s output from that pipe.
If you want all items in C<@ARGV> to be interpreted as file names, you
-can use the module C<ARGV::readonly> from CPAN.
+can use the module C<ARGV::readonly> from CPAN, or use the double bracket:
+
+ while (<<>>) {
+ print;
+ }
+
+Using double angle brackets inside of a while causes the open to use the
+three argument form (with the second argument being C<< < >>), so all
+arguments in ARGV are treated as literal filenames.
You can modify @ARGV before the first <> as long as the array ends up
containing the list of filenames you really want. Line numbers (C<$.>)