On 21 Feb 2003 at 11:15, Tony Kennick wrote: > If I have a quick and dirty one liner using -n or -p to run > through a list of files generated by a shell expansion or find > command, is there a special variable that will tell me the file > my while loop is currently eating through or a method if I > invoke FileHandle. It seams that by the time I get to that point > it has already been shifted off @ARGV.
The file name? It's in $ARGV: $ARGV contains the name of the current file when reading from <>. I often use this in a variation on grep: perl -ne 'print "$ARGV:$.:$_" if /something/ or /other/' *.c which is a bit like grep -n but I can use Perl (specifically useful also for grepping through things such as tarballs by specifying a max line length and converting non-printable characters to question marks or something). Cheers, Philip -- Philip Newton <[EMAIL PROTECTED]>