while(<DATA>) { s/[^\d]+//g; # remove non-digit characters # only digit characters remain m/(.{0,10})$/; # find as many as 10 characters, # starting at the right print $1,$/; # print the found digits } __DATA__ 800-1212 1-800-800-1212 1(800)800-1212 1 (800) 800-1212 1 800 800 1212
In reply to Re^2: Numbers only in a string
by superfrink
in thread Numbers only in a string
by powerhouse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |