Don't ask to ask, just ask | |
PerlMonks |
Re: Need Speed:Search Tab-delimited File for pairs of namesby kcott (Archbishop) |
on Dec 16, 2013 at 19:21 UTC ( [id://1067362]=note: print w/replies, xml ) | Need Help?? |
G'day mnnb, Welcome to the monastery. I suspect you're very new to Perl and have guessed at most of the code you've posted here. Various inconsistencies also suggest you've borrowed code from other sources without understanding what they do. Commenting out strict and warnings is a big mistake: it doesn't fix the reported issues; you've simply stuck your head in the sand and pretended they're not there. I suggest you read perlintro. Follow the links you find there for further information on the various topics that are relevant to your current task and ask here if you don't understand. From your problem description, here's how I might have tackled it.
Output:
As you can see, I've dummied up file and command line input and have only produced basic output. This may not be exactly what you want but should provide some direction: note, for instance, that I've only captured the first column not every tab-separated element; used a for loop instead of your deeply nested if statements; and, printed the original line read rather than attempting to recreate it from the split elements. [For subsequent questions, please follow the guidelines in "How do I post a question effectively?": a better question gets better answers.] -- Ken
In Section
Seekers of Perl Wisdom
|
|