( Just kidding!! :)
#!/usr/bin/perl use strict; use warnings; my $h; while (<DATA>) { chomp; s|^/|\$h->{'|; s|/|'}{'|g; s|([^']*)$|\0$1'} = 1;|; eval; } use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; open my $savedout, ">&STDOUT" or die $!; close STDOUT; open STDOUT, ">", \my $dump or die $!; print Dumper $h; open STDOUT, ">&", $savedout or die $!; open my $fh, "<", \$dump or die $!; while (<$fh>) { s/^(\s*)'/$1/; s/' =>.*//; next if /^\$|\s*}/; print; } __DATA__ /a/f1.mp3 /a/f2.mp3 /a/b/f1.mp3 /a/b/f2.mp3 /a/b/f3.mp3 /a/c/f1.mp3 /a/c/f2.mp3 /a/c/e/f5.mp3 /a/c/e/f6.mp3 /b/d/f4.mp3
Output:
a f1.mp3 f2.mp3 b f1.mp3 f2.mp3 f3.mp3 c f1.mp3 f2.mp3 e f5.mp3 f6.mp3 b d f4.mp3
In reply to Re: Creating table from file lists
by almut
in thread Creating table from file lists
by affc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |