Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Testing <> for undefined

by Roy Johnson (Monsignor)
on Jul 08, 2004 at 16:57 UTC ( [id://372856]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Testing <> for undefined
in thread Testing <> for undefined

I have to say that I hate your use of the trinary operator there. You're expressing that you want to assign die's result to $file. Instead:
my $file = $ARGV[0] or die "Usage: prog.pl file_pathname\n";
(as a bonus, you don't have the redundant mention of $ARGV[0]).
Better, if the filename might be zero:
@ARGV or die "Usage: prog.pl file_pathname\n"; my $file = $ARGV[0];

We're not really tightening our belts, it just feels that way because we're getting fatter.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-29 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found