FAQ
Hi,

when I put this line in a script say a.pl:

#!/usr/bin/perl -wl
...

And later I run it from the command line:
perl a.pl

so, does this make perl ignore the "wl" switch in the script?

Thanks.

--
Free SmartDNS Hosting:
http://DNSbed.com/

Search Discussions

  • Shawn H Corey at Feb 22, 2011 at 3:19 pm

    On 11-02-22 09:57 AM, terry peng wrote:
    Hi,

    when I put this line in a script say a.pl:

    #!/usr/bin/perl -wl
    ...

    And later I run it from the command line:
    perl a.pl

    so, does this make perl ignore the "wl" switch in the script?

    Thanks.
    No, perl reads the shebang line and sets the options.


    --
    Just my 0.00000002 million dollars worth,
    Shawn

    Confusion is the first step of understanding.

    Programming is as much about organization and communication
    as it is about coding.

    The secret to great software: Fail early & often.

    Eliminate software piracy: use only FLOSS.
  • Erez Schatz at Mar 7, 2011 at 8:25 am

    On 22 February 2011 17:19, Shawn H Corey wrote:
    when I put this line in a script say a.pl:
    #!/usr/bin/perl -wl
    so, does this make perl ignore the "wl" switch in the script?
    No, perl reads the shebang line and sets the options.
    perl doesn't do any such thing. In a *nix shell environment, when the
    file is being executed without calling the perl interpreter, the shell
    interprets the line and execute it. If the script is run with "perl
    foo.pl" then the shebang is ignored, as the perl interpreter ignores
    it as a comment. I believe a Windows environment also ignores it.

    --
    Erez

    La perfection soit atteinte non quand il n'ya plus rien à ajouter,
    mais quand il n'ya plus rien à retrancher.
  • Erez Schatz at Mar 7, 2011 at 8:31 am
    spoke too soon. seems that under both linux and windows perl does read
    the shebang line. please ignore previous comment
    On 7 March 2011 10:24, Erez Schatz wrote:
    On 22 February 2011 17:19, Shawn H Corey wrote:
    when I put this line in a script say a.pl:
    #!/usr/bin/perl -wl
    so, does this make perl ignore the "wl" switch in the script?
    No, perl reads the shebang line and sets the options.
    perl doesn't do any such thing. In a *nix shell environment, when the
    file is being executed without calling the perl interpreter, the shell
    interprets the line and execute it. If the script is run with "perl
    foo.pl" then the shebang is ignored, as the perl interpreter ignores
    it as a comment. I believe a Windows environment also ignores it.

    --
    Erez

    La perfection soit atteinte non quand il n'ya plus rien à ajouter,
    mais quand il n'ya plus rien à retrancher.


    --
    Erez

    La perfection soit atteinte non quand il n'ya plus rien à ajouter,
    mais quand il n'ya plus rien à retrancher.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedFeb 22, '11 at 2:57p
activeMar 7, '11 at 8:31a
posts4
users3
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase