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

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!
  • Comment on Re: Re: Re: How to make perl accept symbol open/close bracket?

Replies are listed 'Best First'.
Re: Re: Re: Re: How to make perl accept symbol open/close bracket?
by hyliau (Initiate) on Jun 28, 2003 at 03:52 UTC
    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!