dws' observation not withstanding, there are couple of other 'peculiarities' with your code.

The first is this nested loop

foreach( keys %invalid ) { undef @tmp; @tmp = split $invalid{$_}, /\t/; while( @tmp ) { next if $_ =~ m/$fields[$_]/; } }

Apart from chewing a potentially large number of cycles, this doing nothing that I can see? I think I know what you are trying to do, but next will repeat the nearest enclosing loop.

If you want to skip to the next line from INPUT_FEED, then you would need to use the next LABEL; form.

RECORD: while( <INPUT_FEED> ) { .... foreach my $invalid (keys %invalid ) { ... while( @tmp ) { next RECORD if ...; } }

Then there is this statement

next if $_ = /$fields[$_]/;

You have two references to $_ in that if clause, and I think you are expecting them to refer to different things? They won't!

You have #use strict; at the top of your code. I cannot recommend enough that you uncomment that and add -w or use warnings. And then shut teh compiler up by correcting each problem is finds and yells about.

The compilers attention to detail is pretty impecable. If it tells you there is something wrong, it is usually right:).

Also,

$PostCodeStrings{$fields[5]} = $PostCodeStrings{$fields[5]} . $fields[4] . "|" . $fields[5] . "|" . $fields[3] . "|" . $fields[2] . "|" . $fields[1] . "|" . $fields[0] . "\n";

You could save yourself a lot of typing by using  $x .= ... rather than $x = $x . ..... And even more by using join and an array slice on @fields for the rest of the statement. This should be equivalent.

$PostCodeStrings{$fields[5]} .= join( '|', @fields[4,5,3,2,1,0] ) . "\n";

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.


In reply to Re: File I/O Slow Down by BrowserUk
in thread File I/O Slow Down by agentsim

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.