Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: List vs array printing in perl

by GrandFather (Saint)
on Mar 30, 2016 at 21:19 UTC ( [id://1159170]=note: print w/replies, xml ) Need Help??


in reply to Re: List vs array printing in perl
in thread List vs array printing in perl

Always use strictures (use strict; use warnings; - see The strictures, according to Seuss).

:-D

Premature optimization is the root of all job security

Replies are listed 'Best First'.
Re^3: List vs array printing in perl
by soonix (Canon) on Mar 31, 2016 at 09:25 UTC
    my script template begins with
    use 5.011; # implies strict + feature 'say' use warnings;
    but that doesn't help with a one-liner. There he could use
    perl -wMstrict -e ...
    (that goes without saying, though)

      "Similarly, if the specified Perl version is greater than or equal to 5.12.0, strictures are enabled lexically as with use strict . "

      According to the documentation, you need use 5.012;.

        The docs may be right, but 5.011 works for me (on 5.20):

        $ cat xxx.pl #!/usr/bin/env perl use 5.011; use warnings; $x = 1; $ ./xxx.pl Global symbol "$x" requires explicit package name at ./xxx.pl line 5. Execution of ./xxx.pl aborted due to compilation errors.

        That said, I see no great advantage to having a non-stable-release version as the minimum requirement, especially such an old one. YMMV.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1159170]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-18 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found