good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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. In reply to Re: Useless use of string eq
by Fletch
|
|