Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: pattern matching compilation errors

by muba (Priest)
on Jun 27, 2012 at 01:39 UTC ( #978542=note: print w/replies, xml ) Need Help??

in reply to pattern matching compilation errors

Without wanting to repeat what others said before me, there's one part in this line that stood out to me.

open(FILE,"<",$filename1) or die "\n...Cannot find the file: $filename +";

Namely, the error message. "Cannot find the file" might not be the best to put there. There could be all sorts of other reasons the file couldn't be opened. Perhaps the process doesn't have the right permissions, maybe the file is locked, maybe there are tons of other things that could go wrong. But that's okay, because you can make Perl tell you (more or less) exactly what went wrong!

... or die "\n... Can't open $filename: $!\n";

Replies are listed 'Best First'.
Re^2: pattern matching compilation errors
by Kenosis (Priest) on Jun 27, 2012 at 01:49 UTC

    Good eye, muba!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://978542]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2018-03-21 04:23 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (263 votes). Check out past polls.