in reply to Undefined scalar
Hello Nicpetbio23!,
Just to add something here to analytical explanation by fellow monk stevieb. You can use also the functions undef and defined.
Usually you do not check for a scalar as my example bellow but if a scalar exists specifically in a hash (usually). But just for demonstration purposes see bellow:
#!/usr/bin/env perl use strict; use warnings; my $scalar = undef; if (defined $scalar) { print "\$scalar is defined\n"; } else { print "\$scalar is undefined\n"; } __END__ $ perl test.pl $scalar is undefined
Hope this helps, BR.
|
|---|