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.


In reply to Re: Useless use of string eq by Fletch
in thread Useless use of string eq by Flubb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.