Jump to content

You wanted a Perl example?


G+_Irene Smith
 Share

Recommended Posts

You wanted a Perl example? Here is a link to a phone list. It maintains a text file with names, email addresses, and phone numbers. The biggest flaw is that it doesn't validate the input. I plan to add regex validation for the email address and phone number, but that is harder than I anticipated. If I have time later today, I will add validation. Here is a link to the repository:

 

https://github.com/irenesmith/pearlsbeforeswine/blob/master/phone_example/

 

perl phone.pl

 

will run the program and list the names in the existing text file included in the repository. The use of command line arguments is described in code comments.

https://github.com/irenesmith/pearlsbeforeswine/blob/master/phone_example/phone.pl

Link to comment
Share on other sites

Nice little demo of basic text file processing. Probably a little too long to be featured on the show. (I try to limit mine to a single screen of code.) But with few Perl programs being shared here you might get lucky. I did find a couple minor bugs. The Phone # input in InteractiveAdd is bad (STDIN is misspelled). Also, InteractiveAdd is saving the data as Firstname, Lastname and it looks like the other routines are expecting LastName, FirstName in the record. Anyway, thanks for sharing the program.

Link to comment
Share on other sites

 Share

×
×
  • Create New...