http://www.perlmonks.org?node_id=11132736


in reply to Need a regular expression to check the first digit

If you're looking for the first instance of the character '5' in a string of 9 numeric characters
index is your friend
my $var = '503009496'; my $i = index($var, '5');
I think that is what you are looking for.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.