in reply to Re: Concise foreach expression
in thread Concise foreach expression

print"$path_name\n"x grep/test$/,@names; say$path_name x grep/test$/,@names;
/test$/&&print$path_name,$/for@names; /test$/&&say$path_name for@names;

If he meant $x where he had $path_name,

print"$_\n"x grep/test$/,@names; say for grep/test$/,@names;
/test$/&&print$_,$/for@names; /test$/&&say for@names;
print/.*test$/g,$/ for@names; say/.*test$/g for@names;