in reply to Sort and Print Hashes simultaneously

Doing linear scans over an associative array is like trying to club someone to death with a loaded Uzi. -- TimToady
for my $key (sort { $a <=> $b } keys %websites) { if (exists $newsites{$key}) { print "$key=$newsites{$key}\n"; } }

See also: sort, keys, exists, perlfaq4.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: Sort and Print Hashes simultaneously
by sundeep (Acolyte) on Nov 01, 2010 at 16:49 UTC
    Thanks a lot... I really don't know that, i can do it without a linear search. Anyways, i am learning a lot from u guys.... thanks for the immediate reply....