$t =~ s/\/home\/roboticus\/tmp/\/home\/postgresql\/tmp/; $t =~ s{/home/roboticus/tmp}{/home/postgresql/tmp}; $t =~ s#/home/roboticus/tmp#/home/postgresql/tmp#; #### $ cat t.pl #!/usr/bin/perl my @a = qw(apple banana cherry durian); my @b = grep { s#(a.)+#x#g; m/x/ } @a; print join(", ", @b), "\n"; $ perl t.pl xple, bxa, durix