in reply to Using Split to load a hash
use strict; use Data::Dumper; my %hash; while(<DATA>) { chomp; my $line = $_; my $key = (split/\t/, $line)[0]; push @{ $hash{$key} }, $line; } print Dumper(\%hash); __DATA__ 1 a 101 1 b 110 2 c 201 3 d 301 3 e 310 3 f 320 4 g 401
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using Split to load a hash
by umasuresh (Hermit) on Apr 30, 2010 at 17:33 UTC |