perl $|=1; What is this?

后端 未结 3 726
借酒劲吻你
借酒劲吻你 2021-02-01 17:48

I am learning Writing CGI Application with Perl -- Kevin Meltzer . Brent Michalski

Scripts in the book mostly begin with this:

#!\"c:\\strawberry\\perl\\         


        
3条回答
  •  别那么骄傲
    2021-02-01 17:53

    It does not matter where in your script you put a use statement, because they all get evaluated at compile time.

    $| is the built-in variable for autoflush. I agree that in this case, it is ambiguous. However, a lone $ is not a valid statement in perl, so by process of elimination, we can say what it must mean.

    use lib qw(.) seems like a silly thing to do, since "." is already in @INC by default. Perhaps it is due to the book being old. This statement tells perl to add "." to the @INC array, which is the "path environment" for perl, i.e. where it looks for modules and such.

提交回复
热议问题