in reply to Re: script optimization
in thread script optimization
my ($fi, $fo) = ("/in.CSV", "/out.ins"); open my $hi, "<", $fi or die "$fi: $!\n"; open my $ho, ">", $fo or die "$fo: $!\n";
just my 2cents... apart of the chomp-chop issue and the other things said, can't see the point on to create two extra variables here, why simply not do this?
open my $hi, "<", "/in.CSV" or die $!; open my $ho, ">", "/out.ins" or die $!;
You could also do something with this:
if ($array[0] eq "\"Branchno\"") { next; } if ($array[0] eq "\"\"" ) {next;}
You want to discard this lines?, then do it as early as you can, put both before the substitution lines. In a very big file this can make a difference.
While(<INST>) { next if /^\"(Branchno|)\"/; s/...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: script optimization
by Tux (Canon) on Dec 15, 2011 at 14:49 UTC |