$ perl -MO=Deparse,-p -e '$f = grep /f/, @array ? 1 : 2;' ($f = grep(/f/, (@array ? 1 : 2)));