You have to keep track of the filenames.

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;"


In reply to (crazyinsomniac) Re: Working out which file a script is working on by crazyinsomniac
in thread Working out which file a script is working on by ezekiel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.