On 12-02-07 06:26 AM, Rob Dixon wrote:
in fact, if the objective is to reduce the code to something as brief as
possible then this will do the trick
my $match = (grep $_ eq $customers_zip, @{$states{$customers_state}})
? 'yes' : 'no';
You can use first from List::Util for more efficient code:
use List::Util qw( first );
my $match = (first { $_ eq $customers_zip }
@{$states{$customers_state}}) ? 'yes' : 'no';
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/