Dr.Ruud wrote:
On 2010-09-25 01:57, Vaishnavi Saba wrote:
My query: In the code shown below, How does *grep* compare a scalar( *
$seen{$_}* ) with an array of hash references ( *...@_* ).
=====
@common = inter( \%foo, \%bar, \%joe );
sub inter {
my %seen;
for my $href ( @_ ) {
while (my $k = each %$href ) {
Replace the while-line by:
for my $k ( keys %$href ) {
Why? Either way will work and the while loop will use less memory.
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/