j***3 发帖数: 142 | 1 open FILE, $file
my %NAME = ();
while (my $line = ) {
my @a = split " ", $line;
my $location = $a[2];
$NAME{$a[1]."#".$location} .= $a[0]."#";
}
close FILE;
请问
$NAME{$a[1]."#".$location} .= $a[0]."#";
是什么意思啊?以前没有学过这样用hash的, 也google不到。
谢谢。 | w******p 发帖数: 166 | 2 for input file:
100 A Paris
200 A Chicago
100 B Paris
300 A Chicago
100 B Paris
%Name becomes:
A#Paris ==> 100#
A#Chicago ==> 200#300#
B#Paris ==> 100#100#
the question is not how to use hash, but how to use string:
"." concats strings
".=" similar | j***3 发帖数: 142 | 3 thanks westcamp.
it makes sense now. |
|