I'm attempting to write a quick script for my Unix account at work, and I am running into some errors. It's an HPUX system running (gasp!) Perl 4.0 (Revision 4.0.1.8). I don't have any privileges to upgrade to Perl 5.x.

I started creating a script, and wondered if Getopt::Long was available. So I perl -wc'ed it. And it says that use may clash with a future reserved word, and use strict is a syntax error.

Here is the test script (after I tried to simplify it down to the base problem):

#!/usr/contrib/bin/perl # Note that this path to Perl was # verified using 'which perl' use strict; use Getopt::Long; print "Hello, HPUX.\n";

And this is the error message from perl -wc try.pl:

"use" may clash with future reserved word at try.pl line 3. syntax error in file try.pl at line 3, next 2 tokens "use strict" "use" may clash with future reserved word at try.pl line 4. try.pl had compilation errors.

The perldoc -f use reports that all is like it should be. Removal of the Getopt::Long module provides similar results, and this script was created using nano compiled for HPUX (so there isn't an issue with line endings). And just for giggles I checked the results before and after a chmod +x try.pl call, with no changes.

Pointers to web pages would be welcomed, as would ideas to try out. This isn't mission critical or anything, but it is slightly annoying. I don't know enough shell scripting to be able to write my script without Perl...

And of course, a swift kick would be appreciated if I am missing something glaringly obvious. :)


In reply to Perl 4 errors by Nkuvu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.