Note: This is a reply to the UPDATED code added to the original post.
A few quick observations:
my @wordlist = $line; #split/\t/, $line;
The split is needed here. As it is, this just assigns the whole line to $wordlist[0].
if ($token =~ /('?\w+)/)
This regular expression needs to be written as a character class, and suitably quantified:
if ($token =~ /(['\-\w]+)/)
See http://perldoc.perl.org/perlre.html and http://perldoc.perl.org/perlretut.html.
my $existingfalsefriend;
$existingfalsefriend{$searchword}++;
The second statement assigns to the hash %existingfalsefriend which was declared above. The first statement declares a scalar variable which happens to have the same name but is otherwise unrelated to the hash variable. So, in this context, the first statement does nothing and is unnecessary.
If, after fixing your code, you need further help, I suggest you:
- re-post in a new node (or ask a new SoPW question);
- give an excerpt of each input file (formatted between <code> tags) showing its format and contents; and
- show a sample of the output files (similarly formatted) that you wish to generate from your given input.
This will make it easier for the monks to help you.
HTH,
Athanasius <°(((>< contra mundum
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.