use warnings; use strict; use File::Basename; my @extens = qw(.zip .dmg .tar.gz .pl .pl~ .cgi .mp3 .txt); my @ppal; my $i = 0; foreach my $arch (@ARGV ){ my ($name,$path,$suffix) = fileparse($arch,@extens); $ppal[$i] = []; push @{$ppal[$i]},($path,$name,$suffix); $i++; } foreach my $elem (@ppal){ print "Path:\t@{$elem}[0]\tArchivo:\t@{$elem}[1]\tExtens:\t@{$elem}[2]\n"; } #### use warnings; use strict; use File::Basename; my @extens = qw(.zip .dmg .tar.gz .pl .pl~ .cgi .mp3 .txt); my @ppal; foreach my $arch (@ARGV) { push @ppal, [ fileparse($arch, @extens) ]; } foreach my $elem (@ppal) { print "Path:\t${$elem}[0]\tArchivo:\t${$elem}[1]\tExtens:\t${$elem}[2]\n"; #or: print "Path:\t$elem->[0]\tArchivo:\t$elem->[1]\tExtens:\t$elem->[2]\n"; #or: printf "Path:\t%s\tArchivo:\t%s\tExtens:\t%s\n", @$elem; } #### my @ppal; foreach my $arch (@ARGV) { push @ppal, [ fileparse($arch, @extens) ]; } #### my @ppal = map { [ fileparse($_, @extens) ] } @ARGV;