Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Useless use of string eq

by mpeg4codec (Pilgrim)
on Dec 07, 2007 at 23:29 UTC ( #655773=note: print w/ replies, xml ) Need Help??


in reply to Useless use of string eq

Others have already commented on why it's wrong, but I have some advice that should help make warnings and errors clearer: don't bunch up the code like that. Try writing it like this:

#!/usr/local/bin/perl -w use strict; my($target, $cust, $cotime) = @ARGV; if ($ARGV[1] eq '-SMC') { $cust = "SMC"; } elsif ($ARGV[1] eq '-FET') { $cust = 'FET'; } elsif ($ARGV[1] eq '-China') { $cust = 'China'; } elsif ($ARGV[1] eq '-SBM') { $cust = 'SBM'; }
In this case, the warnings can only be about a single statement, since only one statement ever appears on a given line. It's also a bit more appealing to look at (in my opinion), which is a bonus.


Comment on Re: Useless use of string eq
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (17)
As of 2015-07-06 14:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (75 votes), past polls