http://qs321.pair.com?node_id=652366


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

*cough*

$ perl -e 'if (\'h@t\' =~ /(\@)/ ) { print $1 }' -bash: syntax error near unexpected token `('

Not sure why - does escaping the single quote not work?

Replies are listed 'Best First'.
Re^3: Matching @ in string
by lima1 (Curate) on Nov 22, 2007 at 13:34 UTC
    Because the bash does not change anything in the -e ' .. ' string. And
    if (\'h@t\' =~ /(\@)/ ) {
    is no valid perl.
    And the -e string ends after if (\.