In this case you could use grep:
print "$_\n" for grep {/test$/} @names;
UPDATE: ...or more cryptically: /test$/ and print "$_\n" for @names;.
In reply to Re: Concise foreach expression
by hdb
in thread Concise foreach expression
by ram31
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |