$ cat tc.pl #!/usr/bin/perl use strict; use warnings; my @oldlist = qw X /etc/passwd /etc/group /egg/drop /etc/shadow X; my @newlist = map { my $l = $_; $l =~ s/\/etc\///; my $l2 = $l; } @oldlist; print "\nAfter map (oldlist)\n"; print "=========\n"; foreach (@oldlist) { print "$_\n"; } print "\nAfter map (newlist)\n"; print "=========\n"; foreach (@newlist) { print "$_\n"; } $ ./tc.pl After map (oldlist) ========= /etc/passwd /etc/group /egg/drop /etc/shadow After map (newlist) ========= passwd group /egg/drop shadow $