the whole code snippet can benefit greatly from being simplified:
use strict; use warnings; my @a = qw! / /home /var /tmp /var/tmp !; my @b = map { chomp( my @x = `ls $_` ); [ @x ] } @a; for my $i ( 0 .. $#a ) { print $a[ $i ], $i ? '/' : '', $b[ $i ][ $_ ], "\n\n" for 0 .. $#b +; }
Or perhaps better as:
use strict; use warnings; my @a = qw! / /home /var /tmp /var/tmp !; my @b = map [ m!/$! ? <$_*> : <$_/*> ], @a; print map "$_\n\n", @$_ for @b;
In reply to Re^2: Loop Control
by jwkrahn
in thread Loop Control
by slugman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |