This looks like a task for a regex:
if ( $scalar =~ /^[12345]+$/ ) { print "match"; } else { print "no match"; }
Update: as crazyinsomniac pointed out you can also write:
if ( $scalar !~ /[^12345]/ ) { print "match"; }
alex pleiner <alex@zeitform.de>
zeitform Internet Dienste
In reply to Re: Detect presence of numbers 1-9
by projekt21
in thread Detect presence of numbers 1-9
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |