in reply to Re^2: 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
I did get your code to run and produce your desired result although there is a coding mistake here:
should be:# assign hash value pairs and insert '=' between them to create phoneb +ook my %hash = map { split( /=/, $_, $x + 1 ) } @v; entry
Please re-run the code as a double check before posting on Monks to find these simple cut-n-paste goofs. It is easy to wind up with a goof like this (I've certainly made similar mistakes), but do the best you can. If your code runs "right off the bat", even if there are problems with it, you will tend to get much better answers. Get rid of all of the compile errors and warnings to the extent that you can. And if you can't do that, post the error messages and get advice about them.# assign hash value pairs and insert '=' between them to create phoneb +ook entry my %hash = map { split( /=/, $_, $x + 1 ) } @v;
I don't know what kind of performance or other test case criteria are required. I can only go upon what you have posted. See my code at Re: Perl program to look into the phone directory and in case of a match, print the name along with the number.
In terms of performance, your code besides being pretty obtuse, has many loops and loops within loops.
Some hints:
|
|---|