Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Perl program to look into the phone directory and in case of a match, print the name along with the number

by Marshall (Canon)
on Feb 14, 2017 at 23:07 UTC ( [id://1182023]=note: print w/replies, xml ) Need Help??


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

Hauke D, you are completely right!

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.

next unless ($name,$phone) = $line =~/^\s*([a-zA-Z]+)\s*(\d+)?/;
Thanks haukex!
  • Comment on Re^4: Perl program to look into the phone directory and in case of a match, print the name along with the number
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1182023]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-26 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found