wrote in message news:65c0134b-14b8-4912-a22c-d92389b0b...@fannullone.us...

Hi Shlomi,

Thanks for getting back to me.

What you should do is:

[CODE]

my $host;
unless (defined($xtra))
{
$host = 'localhost';
}

Unfortunately, that gives me the same error.  I had tried it before, but I
was just trying for a one-liner. ;)

It's a bad idea to declare variables with a trailing conditional
statement
modifier (such as "if COND();" or "unless COND();").

Why is it a bad idea?  Can you point me to something to read about this?
My Google searches have been a bit thin on comprehensive information.

Thanks again,
Marc=

Hi Marc,

Try perldoc perlsyn and look for the section 'Statement Modifiers'. There
you'll find:


NOTE: The behaviour of a my statement modified with a statement modifier
conditional or loop construct (e.g. my $x if ...) is undefined. The value of
the my variable may be undef, any previously assigned value, or possibly
anything else. Don't rely on it. Future versions of perl might do something
different from the version of perl you try it out on. Here be dragons.


Chris

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to