I just recently wrote a script that was doing the same thing
with a much smaller sized file yet it didn't run as fast I thought
it should.
Turns out I had a bug in the script.
Here's the buggy script:
...
my $tabCount = 0;
my $line = "";
while(<>) {
...
$tabCount += $#tabs+1;
$line .= $_;
if ( $tabCount == ENOUGH_TABS ) {
print "$line\n";
$tabCount = 0;
}
}
The bug is that I was not doing
$line = "";
when I was doing
$tabCount = 0;
thus printing a larger $line
everytime and slowing things way down.
I dunno but you might wanna make sure you don't
have a bone head bugs like mine :)
Good luck!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|