Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: How do I read the files in @ARGV one by oneby bjelli (Pilgrim) |
on Mar 19, 2001 at 21:39 UTC ( [id://65478]=note: print w/replies, xml ) | Need Help?? |
The trouble with your code is that <> does advanced magic: it reads in all the files on the command line line by line. You can find out which file you are reading right now by looking at $ARGV. So for your little problem, you could remember what $ARGV was when you last read a line and check if $ARGV has changed:
But I admit that Masems code is probably easier to figure out. -- Brigitte 'I never met a chocolate I didnt like' Jellinek http://www.horus.com/~bjelli/ http://perlwelt.horus.at
In Section
Seekers of Perl Wisdom
|
|