in which case a simple regular expression match is probably what you want:
if ($string =~ s/(\d)//) { my $digit = $1; ... } else { print "No digit in '$string'\n"; }
which finds and removed the first digit from $string. Putting the substitution inside an if allows you to deal with not finding a digit.
In reply to Re^2: How do I cut single characters out of a string
by GrandFather
in thread How do I cut single characters out of a string
by akechnie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |