Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

RFC: Tutorial: use strict; now what!?

by Xiong (Hermit)
on Feb 08, 2012 at 09:32 UTC ( #952446=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    use strict;
  2. or download this
    (SOME_ERROR_TEXT) at (FILE) line (LINE).
    Execution of (FILE) aborted due to compilation errors.
  3. or download this
    # Code:
        $x  = 5;                            # no strict 'vars'
    Global symbol "$x" requires explicit package name at li
    +ne 10.
    Global symbol "$x" requires explicit package name at li
    +ne 11.
    Execution of aborted due to compilation errors.
  4. or download this
        my $x;                              # declare first
        $x  = 5;                            # strict okay
        print "$x\n";
  5. or download this
        $newPig    = 'Keisha';
        # much, much later...
        print $Newpig;                      # prints nothing; why?
  6. or download this
    # Code:
        my $subroutine  = factorial;        # no strict 'subs'
    # Output:
    Bareword "factorial" not allowed while "strict subs" in use at strict- line 13.
    Execution of aborted due to compilation errors.
  7. or download this
        my $subroutine  = \&factorial;      # strict okay
        print $subroutine->(7), "\n";
  8. or download this
    # Code:
        our $dog;
    # Output:
    Can't use string ("dog") as a SCALAR ref while "strict refs" in use at
    + line 18.
  9. or download this
        our $dog;
        my $pet     = \$dog;                # hard reference
        ${ $pet }   = 'Rover';              # strict okay
        print "$dog\n";
  10. or download this
    no strict 'vars';
    no strict 'subs';
    no strict 'refs';
  11. or download this
    #       =  Copyright 2011 Xiong Changnian <>   =

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://952446]
Approved by moritz
Front-paged by moritz
[Lady_Aleena]: Hello Discipulus, Corion, choroba, and marioroy...
[Corion]: Hi Lady_Aleena!
[Lady_Aleena]: marioroy, are you also writing a Meditation for this?
choroba o/
Discipulus adds tozzetti alle mandorle to the platter on the sideboard.
Lady_Aleena was checking #cbstream and saw the big announcement.
[marioroy]: Tie::IxHash can be shared. Also similar modules. I cannot wait to post a solution sharing Tie::File and iterating among workers.
[marioroy]: Lady_Aleena Yes, will post something with all the new features. Parallel with few lines of code.
[marioroy]: Yes, will do for PM. I love PM.
Lady_Aleena ponders a meditation of her own, but it would be on a far far less important topic.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-05-26 08:52 GMT
Find Nodes?
    Voting Booth?