in reply to "return" to break out of a loop
The other way to write this and to keep efficiency is something like:
Which is about twice as long. So, I personally like the 4 line version better.my($flag)=0; foreach my $enum( @$enums) { if ( $check_type eq $enum) { $flag = 1; last; } } return $flag;
-Scott
Update: I like anonymous monk's one line grep version above even more :-)
|
|---|