Jeff 'japhy' Pinyan <mailto:[EMAIL PROTECTED]> wrote:
: On Oct 5, Charles Farinella said:
:
: And then you should chomp $_ before going further; otherwise,
: the last element of @array is going to have a newline at the end
: of it.
:
: : my @array = split( "\t", $_ );
:
: chomp;
: my @array = split /\t/; # $_ is assumed here
:
: : $sku = $array[0];
At first glance, I would eliminate @array and keep $sku.
"chomp" would only be necessary if we need the last field of the
array.
while ( <$fh> ) {
my $sku = ( split /\t/, $_ )[0];
$hash{$sku}++;
# test printout
print "$sku [$hash{$sku}]\n" if $verbose;
}
TIMTOWTDI,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>