On 03/08/2014 12:56 PM, David Larochelle wrote:
In terms of style, I suggest you take a look at Perl Best practices. I
would change
$firstline = $_ if $numlines == 0;
to
if ($numlines == 0)
{
$firstline = $_;
}
why even have $numlines? use the buitin $. that alone is a nice little
optimization.
as for slurping, even 100MB isn't much today when you have gigabytes of
ram. i also suspect the double use of $i to be a slowdown. looping over
the array of fields should't need a counter. if you have field names in
the first row, you can use them for hash indexes and not need a counter
at all.
also the shell utils are very fast as they are written in c. using them
for speed is a win in some cases where they do the job as you want it.
they start to fail when the logic needed is too complex for shell tools.
perl wins in flexibility vs the speed of the core shell tools.
uri
--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm