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 strict-demo.pl li
    +ne 10.
    Global symbol "$x" requires explicit package name at strict-demo.pl li
    +ne 11.
    Execution of strict-demo.pl 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-
    +demo.pl line 13.
    Execution of strict-demo.pl 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
    + strict-demo.pl 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
    #       strict-demo.pl
    #       =  Copyright 2011 Xiong Changnian <xiong@cpan.org>   =
    ...
    };
    
    __END__