- or download this
use strict;
- or download this
(SOME_ERROR_TEXT) at (FILE) line (LINE).
Execution of (FILE) aborted due to compilation errors.
- 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.
- or download this
my $x; # declare first
$x = 5; # strict okay
print "$x\n";
- or download this
$newPig = 'Keisha';
# much, much later...
print $Newpig; # prints nothing; why?
- 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.
- or download this
my $subroutine = \&factorial; # strict okay
print $subroutine->(7), "\n";
- 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.
- or download this
our $dog;
my $pet = \$dog; # hard reference
${ $pet } = 'Rover'; # strict okay
print "$dog\n";
- or download this
no strict 'vars';
no strict 'subs';
no strict 'refs';
- or download this
# strict-demo.pl
# = Copyright 2011 Xiong Changnian <xiong@cpan.org> =
...
};
__END__