> Larsen, Errin M HMMA/IT wrote: > > Hi Perl-Crunchers, > > > > I've got the following code: > >
<<CODE SNIPPED>> > > push @ARGV, @logs; > > while( <> ) { > > print "$filename:\n$_" if( /with errors/ ); > > } > > > > Of course, my problem is that I'm not filling in $filename in that > > print statement with a value. I'd really like to be able > to put the > > name of the file the diamond ('<>') operator is currently > parsing in > > there. Is that possible? Do I have access to the individual > > filenames AS they are being used in the while statement? > > > > Thanks ahead of time, > > > > --Errin > > I believe that $ARGV[0] has the file being processed. > So I think you could do something like: > > if ( $. == 1 ) { # on the first read of the current file > print "Filename: " . $ARGV[0] . "\n"; > } > > Wags ;) Hi again, So, the <> operator shift()s the filenames off the top of @ARGV? That's usefull knowledge. On a side note, out of curiosity, can I manipulate the @ARGV array inside the while loop? Or will that cause "unexpected behaviour"? --Errin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>