while(<>) { print "$1\n" for /(\/$pathchrs*$target$path*)/og }