Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Simplify parsing a file

by myrrdyn (Novice)
on Apr 02, 2007 at 18:44 UTC ( [id://607898]=note: print w/replies, xml ) Need Help??


in reply to Re: Simplify parsing a file
in thread Simplify parsing a file

oh, i thought that would give me info about what caused it to die. Now that I looked it up again, do you think $@ is really what I should use?

Replies are listed 'Best First'.
Re^3: Simplify parsing a file
by chromatic (Archbishop) on Apr 02, 2007 at 19:36 UTC

    No. Why would it be? There's no system error. There's merely a usage error.

    You didn't make a system call that failed ($!) and there's no caught exception ($@). Your program didn't get called with any arguments, which your code detects itself, and there's no more information to provide about the source of the error--you know exactly what the source of the error is!

    Now I prefer to write that code as:

    die "No files to process\n" unless @ARGV;

    ... mostly because I prefer the boolean check of the number of elements in @ARGV to checking the number of the last array index.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://607898]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2024-03-28 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found