a variable can be empty (value is undef)
<nit>
The string could be undefined or defined and contain a zero-length string before we move on to containing only spaces or some other text.
$ perl -Mstrict -wE ' > sub grok > { > my $str = shift; > say > defined $str > ? $str > ? qq{>$str<: defined and true} > : qq{>$str<: defined but not true} > : qq{>$str<: undefined}; > } > > my $str; > grok( $str ); > $str = q{}; > grok( $str ); > $str = q{ }; > grok( $str ); > $str .= q{ABC}; > grok( $str );' Use of uninitialized value $str in concatenation (.) or string at -e l +ine 5. ><: undefined ><: defined but not true > <: defined and true > ABC<: defined and true $
</nit>
Cheers,
JohnGG
In reply to Re^2: Regular Expression Help!
by johngg
in thread Regular Expression Help!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |