in reply to when do i know that the iterator for a hash was reseted
use strict; sub find_inB { my ($data_hr, $string) = @_; my $no_result = 'no result'; return ( exists $$data_hr{ $string } ? $$data_hr{ $string } : exists $$data_hr{ lc $string } ? $$data_hr{ lc $string } : $no_result ); } sub look_for_dataB { my %hash = map { ($_, 'xxx'); } qw( A B C D ); print "D: " . find_inB(\%hash , 'D') . "\n"; print "A: " . find_inB(\%hash , 'A') . "\n"; print "B: " . find_inB(\%hash , 'B') . "\n"; print "B: " . find_inB(\%hash , 'B') . "\n"; } print "# look_for_dataB:\n"; look_for_dataB(); __END__ # look_for_dataB: D: xxx A: xxx B: xxx B: xxx
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: when do i know that the iterator for a hash was reseted
by rminner (Chaplain) on Apr 21, 2006 at 09:36 UTC | |
by ff (Hermit) on Apr 21, 2006 at 15:09 UTC | |
by rminner (Chaplain) on Apr 22, 2006 at 10:37 UTC |