in reply to Re: Uninitialized Value Question
in thread Uninitialized Value Question

I'd write that initialization as:

defined($value_a) or $value_a = '';
The ||= op will convert zero to an empty string, which may provide surprises. There is the shiny new //= (I think it is) op to do that, but in the interest of portability I wouldn't use it yet.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^3: Uninitialized Value Question
by philcrow (Priest) on Feb 27, 2007 at 20:04 UTC
    Fair enough, but I favor changing the if condition as in my first example. And, in the OP's code any value (including zero) was going to become the empty string when the regex failed.

    But the subtle problem you raise could well bite others. I'm also looing forward to //= installed most everywhere.

    Phil