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