in reply to hash from CSV-like structure
This does nearly what you want. Perhaps you can modify it to get what you want (but see my question below).
my %hash; while ( <DATA> ) { chomp; my @elts = split /\|_\|/, $_; $hash{$elts[0]}->{$elts[1]} = $elts[2]; } print Dumper \%hash; __DATA__ 200326951|_|rel_Access1|_|200315482|_| 200326951|_|rel_Access1|_|200315786|_| 200326951|_|rel_Access2|_|200315482|_| 200326951|_|rel_Access2|_|200315786|_|
Output:
$VAR1 = { '200326951' => { 'rel_Access2' => '200315786', 'rel_Access1' => '200315786' } };
In your sample output, why does 'rel_Access2' => '200315786' but 'rel_Access1' => '200315482'?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: hash from CSV-like structure
by manav_gupta (Acolyte) on Jan 05, 2008 at 11:38 UTC |