in reply to Re^3: Perl program to look into the phone directory and in case of a match, print the name along with the number
in thread Perl program to look into the phone directory and in case of a match, print the name along with the number
My regex required at least one "space" character after the "name". A line ending ("\n" in Perl lingo) counts as a "space" character although in Windows "\n" might actually be a couple of characters.
This regex also appears to work.
Thanks haukex!next unless ($name,$phone) = $line =~/^\s*([a-zA-Z]+)\s*(\d+)?/;
|
|---|