You could play tricks with tie -- I'm not advocating it, but it is a possibility depending upon your purpose.
{ package Undef; sub TIESCALAR{ bless \pop, 'Undef';} sub STORE{ $$_[0] = $_[1]; } sub FETCH{ defined $$_[0] ? $$_[0] : 0 } }; tie $x, 'Undef'; $x = 0; print "'$x'"; '0' $x = ''; print "'$x'"; '' $x = undef; print "'$x'"; '0'
In reply to Re: Stringifying undefs
by BrowserUk
in thread Stringifying undefs
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |