Bilbo Baggins, Under The Hill Sam Gamgee, Bagshot Row #### 1 #!/usr/bin/perl 2 3 my $file = 'addrfile.txt'; 4 5 open I, '<', $file 6 or die "Can't open '$file' for reading: $!\n"; 7 8 chop (%hash = map { split /\s*,\s*/,$_,2 } grep (!/^$/,)); 9 10 # print out that hash 11 12 print "$_ => $hash{$_}\n" for keys %hash; #### Bilbo Baggins => Under The Hill Sam Gamgee => Bagshot Row #### while (my $line = ) { chop $line; push(@lines,$line); } @lines = grep (!/^$/, @lines); foreach my $line(@lines) { my ($name, $addr) = split /\s*,\s*/,$_,2; $hash{$name} = $addr; } #### while (my $line = ) { chop $line; my ($name, $addr) = split /\s*,\s*/,$_,2; $hash{$name} = $addr; }