"use warnings" not working in Perl 5.8.8



I am a complete newbie to Perl (although I am an advanced PHP programmer). I have installed ActivePerl-5.8.8.817-MSWin32-x86-257965.msi on my Windows XP machine running Apache 2.0.

I am getting this syntax error:
"use" not allowed in expression at c:\hello_world.pl line 2, at end of line

Here is my script:

!# /usr/bin/perl
use warnings;

print "Hello World!\n";

If I take out the "use warnings" directive an replace with
#! /usr/bin/perl -w

it works fine. However, this PDF (http://learn.perl.org/library/beginning_perl/3145_Chap01.pdf) mentions that after Perl version 5.6.x you should not use:

#! /usr/bin/perl -w

but use

#! /usr/bin/perl
use warnings;

instead.

Call me an idiot, but if I have Perl 5.8.8, shouldn't "use warnings;" work in this program??


thanks for any help!
-j
.



Relevant Pages

  • Re: error messege: "subroutine Cwd::fastcwd redefined"
    ... Attached is the file created by perlbug. ... asking for all warnings even though Cwd is trying (via the older ... case it looks like a bug in the Perl distribution. ... HOME (unset) ...
    (perl.beginners)
  • Re: What do you need to have to be considered a Master at Perl?
    ... (--and note the warnings, in particular: ... Because perl's regex engine is not currently re-entrant, ... Quote from "perlre - Perl regular expressions" ... ... defined inside an eval'ed pattern are not available ...
    (comp.lang.perl.misc)
  • Re: file rename help
    ... > I am very novice as you will see in my Perl skills. ... use warnings; ... because I am not afraid of undef values, ... even as a piece of shell code, your command is wasting at least two ...
    (comp.lang.perl.misc)
  • Re: Multiple Parameters
    ... The above two lines ask Perl to hold you to the laws of good ... programming. ... you'll get better error messages and warnings ...
    (perl.beginners)
  • Re: debugger exiting
    ... strict and warnings pragmas. ... I think portraying Perl as a command-line tool limits it to fewer platforms than ... work only as a Unix shell command line. ...
    (perl.beginners)