in reply to or DIE adding line number to error

You could use unless and exit. And if you want to see why it fails you can add $!

unless(open(LOG, "< $file")){ print "Sorry could not open $file - $!","\n"; exit; }

-baztastic

Replies are listed 'Best First'.
Re^2: or DIE adding line number to error
by thor (Priest) on Mar 10, 2005 at 05:38 UTC
    Why print "Sorry could not open $file - $!","\n"; and not print "Sorry could not open $file - $!\n";? I know that they're equivalent, but you don't have to put the newline in its own string...

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

      To be honest I don't know. I was incredibly distracted when I wrote the response. When I originally started to reply no one else had replied yet, I probably should have looked it over better before submitting it.
      -baztastic