[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Dimensional question



Here is something.

#!perl -w
use strict;
use Data::Dumper;

my %s;
while (<DATA>){
  my($ref, @tmp) = (\%s, split);
  for my $i (0 .. $#tmp) {
    $ref->{$tmp[$i]} = $i == $#tmp ? 1 : {};
    $ref = $ref->{$tmp[$i]};
  }
}
print Dumper \%s;
__DATA__
a 1 2 3
b 4 5
c 6 7 8 9 10 11 12

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org