On Nov 30, 2007 10:56 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello,
>
> how can I test if the nth (n=2) sign of a string is a number [0-9]?
> Thank you.
>

Hello,

Given you have this string: $str = "a9d0";

you can check if the 2nd character is a number or not by:

my $c = substr($str,1,1);
print $c=~/[0-9]/ ? "a number" : "not a number";

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to