Hm, your exact request is vague. To extract a list of digits from a data stream, I suggest one of the following:
my $variable = '12345(checkthis)'; my @digits; undef @digits; while ($variable =~ /\d/g) { push @digits, $& }
Each case will result in a list of digits stored in @digitsmy $variable = '12345(checkthis)'; my @digits; undef @digits; foreach (split '', $variable) { push @digits, $_ if /\d/ }
The Eightfold Path: 'use warnings;', 'use strict;', 'use diagnostics;', perltidy, CGI or CGI::Simple, try the CPAN first, big modules and small scripts, test first.
In reply to Re: what is the best way to seperate the digits and strings from variable ?
by radiantmatrix
in thread what is the best way to seperate the digits and strings from variable ?
by swaroop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |