
Jasmine
Administrator
/ Moderator
May 21, 2001, 9:36 AM
Post #3 of 3
(386 views)
|
|
Re: A list of if's rather then 10 elsif
[In reply to]
|
Can't Post
|
|
I'm not sure I understand either, but I'll give it a shot anyway. Let's say your input is in a hash.
my %fields = ( 1 => '', 2 => '2', 3 => '', 4 => '4', ); my $count = grep{ $_ } values %fields; Above is a simple hash with some empty entries. Then, using grep, we assign $count with the count of true values in $fields. $count will be 0 ( false ) if there's no true values entered. So you can use:
if ( $count ){ # values exist, do something. } Hope this helps!
|