in reply to Working out which file a script is working on
You cannot retrieve a filename from a filehandle (see Is it possible to get a filename from a filehandle? )
You death needs to be more meaningful.
In other words, don't just die;
You should be doing something like (no real reason you shouldn't):
for $file(@ARGV) { open(FHF,$file) or die("Can't open $file $!"); while(<FHF>) { die "crap $file $!" unless ($verified); } close(FHF); }
update:
japhy got his answer from perlop (too much magic for me), and apparently (from perlopI/O Operators):
The null filehandle <> is special: it can be used to emulate the behav +ior of sed and awk. Input from <> comes either from standard input, o +r from each file listed on the command line. Here's how it works: the + first time <> is evaluated, the @ARGV array is checked, and if it is + empty, $ARGV[0] is set to ``-'', which when opened gives you standar +d input. The @ARGV array is then processed as a list of filenames. Th +e loop while (<>) { ... # code for each line } is equivalent to the following Perl-like pseudo code: unshift(@ARGV, '-') unless @ARGV; while ($ARGV = shift) { open(ARGV, $ARGV); while (<ARGV>) { ... # code for each line } }
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"
|
|---|