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

Re: Useless use of string eq

by Fletch (Bishop)
on Dec 06, 2007 at 14:37 UTC ( [id://655418]=note: print w/replies, xml ) Need Help??


in reply to Useless use of string eq

The eq operator is for comparing strings. Using it in a context other than a comparison (like you've done correctly with your if and elsifs there) doesn't make much sense because it doesn't do anything other than return a true or false value in and of itself (which is why you're being warned that it's useless).

Guessing from the context you're trying to assign something to $cust so you want the assignment operator = instead: $cust = 'SMC';.

Update: And a bit more of a better long term solution would be to look into one of the standard argument parsing modules like Getopt::Long and use that instead of trying to cobble together your own.

Another thing: I notice you give your option in your sample command line as -fet all lower case but you're comparing against -FET. String comparisons are case sensitive so that's not going to match (and even Getopt::Long wouldn't help you here). Pick a case and stick with it, or use lc (or uc) to canonicalize everything to one or the other before you attempt to compare them.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-25 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found