One of the main reasons these practices are unsafe is that they often occur by accident.
Here are some quick examples of mistakes that will cause errors with strict:
Using strict also encourages good coding practices such as controlling the scope of your variables (strict 'vars') and using hard references instead of soft references (strict 'refs').my $variable = 7; print $varaible; # typo # error from strict 'vars' my $hash = { name => 'value' }; my $key = 'name'; print $key->{'name'} # derefenced wrong variable # error from strict 'refs' sub subroutine { } print subrotine; # typo # errors from strict 'subs'
In reply to strict; why these practices are unsafe
by chipmunk
in thread What happens with empty $1 in regular expressions? (was: Regular Expression Question)
by marcblecher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |