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

Amazing! Problem is that I don't know most of that syntax (I guess it a perl pro level). I'll try to understand it and simplified it. Thank you
  • Comment on Re^2: Converting hash structure into a special tree

Replies are listed 'Best First'.
Re^3: Converting hash structure into a special tree
by ovedpo15 (Pilgrim) on Jan 13, 2019 at 23:55 UTC
    You sure about the code? tried to run it and I get:
    `-- hello_world.pl ,bin-perl_world.pl ,bye.pllo_world.pl ,bye.pl,strict.pml ,strict.pmworld.pl ` `-- bin-perl

      Best guess - the code got corrupted while being copied.

      Or maybe while being "simplified".

      Since you didn't post the actual code you are running, it's hard to tell :(

        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?