Jun 2, 2009, 7:49 PM
Post #1 of 5
testing number at start of string
i have a string and i am trying to test if there is a number at the
my $string = "12 asdkjh";
if( $string =~ m/^d+/)
print " starts with a number";
when i run that i get nothing, but when i run this
if ( $string =~ m/^[0-9]/)
print " got a number at the start ";
i get -> got a number at the start...
am i doing something wrong here ....
because ^ = start of string
d = digit
d+ = 1 or many times