It produces the ZERO message :) Matching the whole string produces better results:
#!/usr/local/bin/perl use strict; use warnings; my $value = 10; SWITCH: for ($value) { /^0\z/ && do {print "ZERO\n"; last; }; /^1\z/ && do {print "ONE\n"; last; }; /^10\z/ && do {print "TEN\n"; last; }; print "NONE OF THE ABOVE\n"; }
In reply to Re: Re3: Use an array slices
by hypochrismutreefuzz
in thread Use an array slices
by nite_man
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |