in reply to Syntax Error

Error Message: ksh: 0403-057 Syntax error: `(' is not expected.
Try feeding the program to perl. (Perl, that is. Perl, perl, perl. No 'a' in it).

Abigail

Replies are listed 'Best First'.
Re: Re: Syntax Error
by eudoro (Initiate) on Jan 20, 2004 at 16:07 UTC
    Sorry about the 'a'. How do I feed it to perl? I thought I just had to place the statement: #!/usr/bin/perl -w in the script. Eudoro
      There are a couple of possibilities here.

      1 -- The 'shebang line' ("#! /user ...") may have a leading space. The Shell, not finding '#!' as the first two characters takes off an tries to parse/run the "ksh" script it has just discovered.

      2 -- The first line in the file is empty, so the Shell having no other guidance takes off and fails during the parse.

      ----
      I Go Back to Sleep, Now.

      OGB

        The handling of #! as the first two bytes of the file is a kernel issue. It's the kernel that looks at the first couple of bytes of an executable, and then decides how to run it. When issued properly, no shell will be involved. In fact, if the program gets fed to the shell, the first line will be ignored. # is, afterall, the start of a comment.

        Abigail

        A third (unlikely) possibility is that Eudoro is executing the script on the commandline as follows
        $ ksh my_script.pl

        As I said, unlikely, but possible.

        ------
        We are the carpenters and bricklayers of the Information Age.

        Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      Placing a she-bang line is only half the trick - the kernel must also sniff at it. How are you calling your program, and what are its execution bits?

      Abigail

        I am executing it using: . ./test.pl