while(<DATA>) {
($key, $value) = split / /, $_;
$hash{lc($key)} = 1;
push(@array, "$key$value");
}
foreach $key (sort keys %hash) {
@arr = (grep /$key/i, @array);
chomp(@arr);
$val = join (", ", @arr);
$val =~ s#$key##gi;
print "$key\t$val\n";
}
__DATA__
xxxA 2
xxxA 1
xxxB 2
XXXC 3
XXXA 3
xxxD 4
($key, $value) = split / /, $_;
$hash{lc($key)} = 1;
push(@array, "$key$value");
}
foreach $key (sort keys %hash) {
@arr = (grep /$key/i, @array);
chomp(@arr);
$val = join (", ", @arr);
$val =~ s#$key##gi;
print "$key\t$val\n";
}
__DATA__
xxxA 2
xxxA 1
xxxB 2
XXXC 3
XXXA 3
xxxD 4
No comments:
Post a Comment