Hi
swaroop, please post these questions in
Seekers of Perl Wisdom instead of
Perl Monks Discussion. Also, try to work your examples out a little better: use code tags and quotes around strings :)
Your question is a little vague, but if you want to extract digits at the beginning of a string you can use the following regex:
my $variable = '12345(checkthis)';
$variable =~ /^(\d*)/;
my $start_digits = $1;
or, more concisely:
my $variable = '12345(checkthis)';
my ($start_digits) = $variable =~ /^(\d*)/;
Note that in the last example you HAVE to put parenthesys around
$start_digits, to force a list/array context evaluation.
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')
Don't fool yourself.