How can I combine two conditions in Perl?

Posted by yael on Stack Overflow See other posts from Stack Overflow or by yael
Published on 2010-05-27T09:33:27Z Indexed on 2010/05/27 11:41 UTC
Read the original article Hit count: 322

Filed under:

I have two Perl one liners:

perl  -pe "s/\b$a\b/$b/g if m/param1 /"  test

and

perl  -pe "s/\b$a\b/$b/g unless /^#/" test

How can I combine theif m/somthing/ and the unless /something/, like:

[root@localhost tmp]#  perl  -pe "s/\b$a\b/$b/g if m/param1/ unless /^#/"  test
syntax error at -e line 1, near "m/param1/ unless"

© Stack Overflow or respective owner

Related posts about perl