On 15/08/07, Peter Gordon <[EMAIL PROTECTED]> wrote:
> @w = (1, 2, 3, 4, 5) ;
> grep { $w->{$_} ++ } @w ;
> print "found\n" if exists $w->{3} ;

Hmm, it's a nice Perlish trick, but to make it run under use strict, i
had to rewrite it like this:

my @w = qw(Reuven Shimon Levi Yehuda);
my $w = { };
grep { $w->{$_} ++ } @w;

print "found\n" if exists $w->{'Levi'};

... And that doesn't improve readability and maintainability. So this
would be too Perlish for production code that will have to be
maintained for years to come.

However, it can be OK, if it brings up a significant performance boost
... does it?
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to