Larsen, Errin M HMMA/IT wrote:

So, the <> operator shift()s the filenames off the top of @ARGV? That's usefull knowledge.

Yes, but it does it before the loop starts!

$ perl -le'

print for @ARGV;

print;

while (<>) { print "$ARGV\t$ARGV[0]" if $. == 1; close ARGV if eof }

print;
print for @ARGV;
' test04.txt test05.txt test06.txt
test04.txt
test05.txt
test06.txt

test04.txt      test05.txt
test05.txt      test06.txt
test06.txt


You can see that the current file name has already been removed from @ARGV inside the while loop.


  On a side note, out of curiosity, can I manipulate the @ARGV array
inside the while loop?  Or will that cause "unexpected behaviour"?

Yes you can if you *REALLY* want to do that.



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to