Owen Cook wrote:
my %data_hash;

while(<DATA>){
chomp;      # Get rid of line feeds
my @bits = split;
$data_hash{$bits[0]} = $bits[1];
        }

It will only remove duplicate key.

Is this still acceptable in perl (its very ugly =(

while (<>) {
  chomp;
  my ($k, $v) = split /,/;
  my $tmp_key = $k . "_" . $v;
  $hash{$tmp_key} = $_;
}

foreach $key (sort(keys %hash)) {
  my ($k, $v) = split /_/, $key;
  print  "$k => $v\n";
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to