in reply to forcing numeric context

If you want it to be zero why not just make it so. If will still eval as false in conditionals...

use warnings; my $v = ''; $v ||= 0; print "\$v = '$v'";

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: forcing numeric context
by John M. Dlugosz (Monsignor) on Dec 18, 2002 at 05:27 UTC
    Re: If you want it to be zero why not just make it so.

    This is a version tuple for a C++ DLLs and EXEs. In one place, it is omitted if the "patch" value is not used, and that is the way it appears in the GUI. In another place, I need all 4 numbers separated with commas, regardless.

    This is a program that takes release information via a nice user-friendly form, and updates the directory tree, changing all the places the version appears in files. If the program wasn't already using an empty string here (other code formats it different ways in different uses), I'd probably just use numbers consistantly.

    So the short answer: maintainance often contradicts good design.

    —John