in reply to Re: How to make perl accept symbol open/close bracket?
in thread How to make perl accept symbol open/close bracket?

hi,
still not working using the '(abc)' as an example.

pls refer to below example of $ARGV2 value which contains the symbol open/close bracket.

Message from user AUDIT on SMDI22 Security alarm \(SECURITY\) and security audit \(SECURITY\) on SMDI22, + system id: 62940 Auditable event: Remote interactive breakin detection Event time: 26-JUN-2003 17:52:51.48 PID: 20405AE3 Process name: _TNA147: Username: HJKH Terminal name: TNA147:, _TNA147:, Host: 100.10.80.100 Po +rt: 59469 Remote node id: 1678397540 Remote node fullname: 100.10.80.100 Remote username: TELNET_640A5064 Status: %LOGIN-F-NOSUCHUSER, no such user

Replies are listed 'Best First'.
Re: Re: Re: How to make perl accept symbol open/close bracket?
by cfreak (Chaplain) on Jun 27, 2003 at 13:28 UTC

    gjb is correct. The problem is in your shell. Perl doesn't care if you have parenthesis in your variable (except maybe in a regex). I assume the message you printed above in output from something. The parenthesis are escaped because someone programmed it to do that. That has nothing to do with the input of the program.

    I copied your program and ran it and it worked fine as long as the arguments are quoted. It might be a difference in shells (I use bash on Linux) so you might try escaping the parenthesis by using a \ character.

    Hope that helps

    Lobster Aliens Are attacking the world!
      Thanks for your guideline.
      Here is the way that I tested. In unix command prompt.

      # perl multi.pl a b ccc-ddd_eee\ > fff:ggg.hhh, iii(jjj)lllll /sbin/sh: Syntax error: `(' is not expected. #

        Your own error message is from your shell

        /sbin/sh:
        That's the program that produced the error message. Perl never sees the argument. The part before the ":" in your error message is always the calling program. If Perl was having a problem you would see 'perl' or '/usr/bin/perl' or somesuch there.

        You need this:
        #perl multi.pl "a b ccc-ddd_eee\ > fff:ggg.hhh iii(jjj)lllll"

        Or

        #perl multi.pl a\ b\ ccc-ddd_eee\\\n\ fff:ggg.hhh\ iii\(jjj\)lllll

        Note that I escaped the spaces too as I assume you want to pass your program just one argument, while the spaces create multiple arguments.

        Lobster Aliens Are attacking the world!