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

Minimal example exhibiting a double reference autovivification trick (learnt from Brian McCauley in a clpmisc thread) to convert a list of structured strings as that below the __END__ token to a complex data structure as that illustrated by the output of the program. More details follow.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %dirhash; while (<DATA>) { chomp; my $last=\\%dirhash; $last=\$$last->{$_} for split qr|/|; } print Dumper \%dirhash; __END__ /file.txt /a/file.txt /a/b/c /a/b/c/file.txt /z/m/w/file.txt