hi,,, blazar, check out this code updates:
my $test = $b; $test =~ s/\s+//g; if ($test != 0) { $test =~ s/[1-5]//; print "It is either 1,2,3,4,5\n" if ! $test and $test ne "0"; }it may seems to be lenghty for me but if you've got shorter codes for this, then you can modify it or create a better one.
What can I say? PerlPhi, please do not take this as a personal offense, I find it overly complex, clumsy, hard to parse and understand. If you really want to go the way of a regex, and I find it quite reasonable, what's wrong with the right™ one?
you may add any additional at @_ to test.
Incidentally, I wouldn't use $b as a general purpose scalar, nor @_ as a general purpose array.
In reply to Re^6: Quicker way to do this IF statement 1-5
by blazar
in thread Quicker way to do this IF statement 1-5
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |