in reply to Re: shebang arguments
in thread shebang arguments

Another difference is that if someone runs the perl command against your script then the shebang line will be ignored while "use warnings" will still be enforced.

It may be ignored by the shell, but it isn't ignored by perl.

foo.pl: #!/usr/bin/perl -w $x = $y . $z; $ ./foo.pl Name "main::y" used only once: possible typo at ./foo.pl line 3. Name "main::z" used only once: possible typo at ./foo.pl line 3. Name "main::x" used only once: possible typo at ./foo.pl line 3. Use of uninitialized value in concatenation (.) or string at ./foo.pl +line 3. Use of uninitialized value in concatenation (.) or string at ./foo.pl +line 3. $ perl foo.pl Name "main::y" used only once: possible typo at foo.pl line 3. Name "main::z" used only once: possible typo at foo.pl line 3. Name "main::x" used only once: possible typo at foo.pl line 3. Use of uninitialized value in concatenation (.) or string at foo.pl li +ne 3. Use of uninitialized value in concatenation (.) or string at foo.pl li +ne 3.

BTW, you can use perl -X to force it to ignore -w on the shebang, if you want.

Replies are listed 'Best First'.
Re^3: shebang arguments
by Argel (Prior) on Jul 03, 2008 at 21:12 UTC
    Ahh, so perl actually checks! Nice!