http://qs321.pair.com?node_id=655460


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