good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Actually, I think it's worth mentioning that if you want only the digits in the beginning of the string you can do something like this:
That numifies $variable, which happens to exclude everything starting from the first non-digit character. Other (twisted) ways of doing the same would include the spacestation: $variable = -+- '12345(checkthis)'; If, OTOH, you really want all the digits, regardless of them being in the beginning of the string, or even of them being together or separated by other chars, you can always use some silly regexen twisting such as: $variable = join '', "12345(checkthis)" =~ /\d*/g; In reply to Re: what is the best way to seperate the digits and strings from variable ?
by cog
|
|