in reply to Hash of arrays
use Data::Dumper; use strict; my %hash; while (<DATA>) { chomp; next unless $_; my @bits = split /: |;/; my $key = shift @bits; $hash{$key} = \@bits; } print Dumper \%hash; __DATA__ t-98: 12;3;56;24 t-56: 1;98 t-3 : 12;56
This generates the desired data structure:
$VAR1 = { 't-98' => [ '12', '3', '56', '24' ], 't-3 ' => [ '12', '56' ], 't-56' => [ '1', '98' ] };
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hash of arrays
by broquaint (Abbot) on Nov 04, 2002 at 14:18 UTC | |
by tachyon (Chancellor) on Nov 04, 2002 at 14:38 UTC | |
by broquaint (Abbot) on Nov 04, 2002 at 14:47 UTC | |
by strider corinth (Friar) on Nov 04, 2002 at 21:05 UTC | |
by jdporter (Paladin) on Nov 04, 2002 at 17:56 UTC |