On Thu, 15 Nov 2012 10:46:34 +0000 jet speed <speedj...@googlemail.com> wrote: > I was able to build the hash, however the file contains approx > 10,000 entries. but while i print the hash i get only approx 1300 > lines or key=>values. > > i guess its because, the file has duplicate entries. example below [...] > How do i build all the entries into hash including the duplicates on > both sides keys and values.
Yes, later lines with the same key would overwrite any previous value for that key, that's how hashes work. In your initial mail you didn't mention that there are duplicate keys. What is it you want to achieve? Store an arrayref of potentially multiple values for each key? If so, for each key & value pair you could say something like: push @{ $hash{$key} }, $value; Then later, e.g.: say "Values for 22:5a are: " . join ',', @{ $hash{'22:5a'} }; Is that what you're looking for? -- David Precious ("bigpresh") <dav...@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/