in reply to Re: one liner error
in thread one liner error

Just to expand for *NIX shells, you need to avoid whitespace and other characters the shell is going to interpret specially: e.g. parens, curlies, braces, splats, dolar signs, ampersands, semicolons, and backslashes (and that's in no ways an exhaustive list). Usually you can backslash them to escape them, but you're going to wind up with leaning toothpick syndrome. It'll be much simpler (to say nothing of fewer characters) if you just break down and (single) quote things and be done with it.

$ uptime | perl -nE m\{\(load\ averages:.\*\)\}\&\&say\$1 load averages: 1.12 1.02 0.95 $ uptime | perl -nE 'm{(load averages:.*)}&&say$1' load averages: 0.84 0.96 0.93

(Insert Jurasic Park quote about could versus should)

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^3: one liner error
by AnomalousMonk (Archbishop) on May 27, 2020 at 15:22 UTC

    Simpler? Simpler? I don' need no stinkin' simpler! I've got Windose!


    Give a man a fish:  <%-{-{-{-<

      🤮 poor thing ...
Re^3: one liner error
by perlfan (Parson) on May 28, 2020 at 07:05 UTC
    >Jurasic Park

    It's a UNIX system. You know this. xD

    Also the source of the "hold your butts" meme for when you're deploying something tricky or not well tested...talk about bout an effect on nerd culture.