Matt Garrish wrote:
> an undef value
> is equal to an empty string. (I thought this behaviour was defined in
> perlop, but it appears not. Is it just assumed that people will know, or
> have I just forgotten where the reference is? I expect the latter...)
perldoc perlsyn
A variable holds the undefined
value ("undef") until it has been assigned a defined value,
which is anything other than "undef". When used as a
number, "undef" is treated as "0"; when used as a string, it
is treated the empty string, """"; and when used as a
reference that isn't being assigned to, it is treated as an
error. If you enable warnings, you'll be notified of an
uninitialized value whenever you treat "undef" as a string
or a number. Well, usually. Boolean ("don't-care")
contexts and operators such as "++", "--", "+=", "-=", and
".=" are always exempt from such warnings.
Paul Lalli
|