$x?$y=1:$y=~s/.*/0/; #### my $y = 1; $y = 0 if (!$x); #### my $y = "a big string of something"; if (!$x) { $y =~ s/somebigoldregex/etc/; }