The trinary operator is another possibility. It allows an if.. else.. construction and can be nested. print /pattern/ ? "$_$/" : '' for @arr;
After Compline,
Zaxo
In reply to Re: One-liners: Conditionals in Loops
by Zaxo
in thread One-liners: Conditionals in Loops
by David Caughell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |