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
index is your friend
I think that is what you are looking for.my $var = '503009496'; my $i = index($var, '5');
In Section
Seekers of Perl Wisdom