Active Entries
- 1: Advent, day 5
- 2: Today's programming silliness
- 3: The highly inaccurate guide to the Eurovision Song Contest 2022 results!
- 4: Bang!
- 5: How not to get people to use a new feature
- 6: Misty creek and eerie fog
- 7: Remember...
- 8: Brexit means arrows?
- 9: boggyb's highly inaccurate guide to Eurovision: Shine a Light 2
- 10: Brighton again
Style Credit
- Style: Neutral Good for Practicality by
Expand Cut Tags
No cut tags
no subject
Date: 2008-11-23 04:10 pm (UTC)It gives you a warning if you
use warnings— otherwise that block silently goes on the else path.undefis actually fairly close to a NULL style value, can be used as that fairly easily. But there is no difference between having an undef value and not existing in the first place, unless youuse strict(you should) which will gladly smack your fingernails if you use an undeclared variable. It should be noted that any and every variable declared will initially have an undef value.ralesk@eretnek:~$ perl -e 'use warnings; undef $foo; if ($foo == 2) { print "do something\n"; }' Use of uninitialized value $foo in numeric eq (==) at -e line 1. ralesk@eretnek:~$ perl -e 'use strict; undef $foo; if ($foo == 2) { print "do something\n"; }' Global symbol "$foo" requires explicit package name at -e line 1. Global symbol "$foo" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. ralesk@eretnek:~$ perl -e 'use strict; my $foo; undef $foo; if ($foo == 2) { print "do something\n"; }' ralesk@eretnek:~$