$ perl -MO=Deparse $f= grep {/f/} @array ? 1 : 2; $f = grep({/f/;} @array ? 1 : 2);