http://qs321.pair.com?node_id=918212


in reply to converting a text into a hash datastructure

my @textsplit= split /\./, $text; my $p= pop @textsplit; foreach (reverse @textsplit) { my $new->{$_}= $p; $p= $new; }

But this naturally won't work if you want to convert many text lines with common parts (i.e. "a.b.c.d" and "a.b.n.m") and want to get one single data structure out of it

UPDATE: davido found a bug in my code. Corrected with addition of $new.