Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Useless use of string eq

by johngg (Canon)
on Dec 06, 2007 at 17:08 UTC ( #655460=note: print w/replies, xml ) Need Help??


in reply to Useless use of string eq

Another alternative would be to use a lookup table. It doesn't gain you much except, perhaps, readability in this particular instance where you are just losing the leading hyphen. However, it would be more useful in tranforming text further, e.g. 'UK' => 'United Kingdom'.

use strict; use warnings; my ( $target, $cust, $cotime ) = @ARGV; my %lookup = ( q{-SMC} => q{SMC}, q{-FET} => q{FET}, q{-China} => q{China}, q{-SBM} => q{SBM}, ); if ( exists $lookup{ $cust } ) { $cust = $lookup{ $cust }; print qq{Customer set to $cust\n}; } else { warn qq{Customer $cust not recognized\n}; }

I hope this is of use.

Cheers,

JohnGG

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2022-01-23 13:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (63 votes). Check out past polls.

    Notices?