in reply to Count non-empty hash values
Try just greping:
my $non_empty = grep { $a{$_} ne "" } keys %a; print "Keys with non-empty values: $non_empty\n"; __END__ Keys with non-empty values: 2
You then need to decide whether undef of 0 entries are empty or not.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Count non-empty hash values
by Joost (Canon) on Oct 22, 2005 at 17:47 UTC | |
by fishbot_v2 (Chaplain) on Oct 22, 2005 at 17:58 UTC | |
by ikegami (Patriarch) on Oct 22, 2005 at 21:23 UTC | |
by Joost (Canon) on Oct 23, 2005 at 00:36 UTC | |
by ikegami (Patriarch) on Oct 23, 2005 at 03:05 UTC | |
by saskaqueer (Friar) on Oct 22, 2005 at 18:33 UTC | |
by pboin (Deacon) on Oct 22, 2005 at 19:11 UTC | |
by Joost (Canon) on Oct 23, 2005 at 00:46 UTC |