There is no equivalent operator to force an expression to be interpolated in list context because in practice, this is never needed. If you really wanted to do so, however, you could use the construction @{[ (some expression) ]}, but usually a simple (some expression) suffices.I wanted to see if there are at least three a's in "baa baa black sheep", so I write:
This doesn't work, but obviously the @{[...]} strategy does work. Is there any simpler way?print (('baa baa black sheep' =~ /a/g) >= 3 ? 'more' : 'less');
In reply to Counting matches. by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |