in reply to Re^5: Quicker way to do this IF statement 1-5
in thread Quicker way to do this IF statement 1-5
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Quicker way to do this IF statement 1-5
by PerlPhi (Sexton) on May 21, 2007 at 18:06 UTC | |
by blazar (Canon) on May 21, 2007 at 20:43 UTC |