http://www.perlmonks.org?node_id=652370


in reply to Re: Matching @ in string
in thread Matching @ in string

OK, so I was missing something obvious.

But if I don't want to modify the string by escaping the @ and I want to run program as a one-liner, how do I do it if I can't escape the single quotes as you point out here?

Thanks,

loris


"It took Loris ten minutes to eat a satsuma . . . twenty minutes to get from one end of his branch to the other . . . and an hour to scratch his bottom. But Slow Loris didn't care. He had a secret . . ." (from "Slow Loris" by Alexis Deacon)

Replies are listed 'Best First'.
Re^3: Matching @ in string
by dwu (Monk) on Nov 22, 2007 at 13:52 UTC
Re^3: Matching @ in string
by mwah (Hermit) on Nov 22, 2007 at 14:34 UTC
    ... don't want to modify the string by escaping the @ and I want to run program as a one-liner, how do I do it if I can't escape the single quotes

    Try: ...

    perl -e "print 'h@t'=~ /\@/g"
    or even
    echo 'h@t' | perl -ne 'print /\@/g'

    ... depending on the type of problem you are about to solve.

    Regards

    mwa