Using 'defined' keyword in if statement
#!/usr/bin/perl -w use strict; my ($a, $b); $b = 10; if (defined $a) { print "\$a has a value.\n"; } if (defined $b) { print "\$b has a value.\n"; }