in reply to Re^4: Converting hash structure into a special tree
in thread Converting hash structure into a special tree

The code which I tried to run:
local $_ = join '', sort map "$_\n", map { join ',', reverse split /,/ } map s/\.\/|\n//gr, <DATA>; sub transpose { my $tmp = ''; $tmp .= "\n" while s/^./ $tmp .= $&; '' /gem; $_ = $tmp; } my @p = map quotemeta, /[^,\s]+/g; my $lead = do { local $" = '|'; qr/(@p)/ }; 1 while s/^[-| ]*\K$lead,/|-- /m; my $line = ''; $line |= $_ for /.+/g; my $length = length $line; s/.+/ sprintf "%-${length}s", $& /ge; transpose; s/\|*\K\|/`/g; transpose; s/ +$//gm; s/--(?= [|`])/ /g; s/^/ /gm; s/ /`-- /; print; __DATA__ ./strict.pm,./hello_world.pl ./strict.pm,./bye.pl,./hello_world.pl ./hello_world.pl ./bye.pl,./hello_world.pl ./bin-perl,./hello_world.pl ./bin-perl,./bye.pl,./hello_world.pl
It's before I tried to simplified. Speaking about simplifying. I really have no I idea what those operators do. Do you have a link where I can view them?

Replies are listed 'Best First'.
Re^6: Converting hash structure into a special tree
by tybalt89 (Monsignor) on Jan 14, 2019 at 02:05 UTC

    The code you just posted runs fine on my linux machine.

    Are you running it in a standard terminal?
    Are you trying to run it in a browser?

    You don't need a link, just use perldoc. Start with "perldoc perl" on your command line.

      Yes I know that it runs fine. But it does not quite do what I needed It uses a real directory data (uses fine). There is a function and it gets an array and I'm not sure how the array format should look like