Unusual warning - what's it trying tell me?

D

Derek Fountain

I've just inherited a rather horrible bit of code which I'm making run
with use strict. (Yes, it's that bad.) It contains this:

if ( ( $e > ( $rt + $ett ) )
&& ( $rt ne "" )
&& ( ${kill} == $TRUE ) )
{

where $kill is a local (my) variable. This produces this:

"Ambiguous use of ${kill} resolved to $kill at ..."

If I remove the {} from around the kill (which are unnecessary anyway)
then the problem goes away. I've never seen that and it puzzles me.
What's it trying to tell me? The function contains a varible called
$killed is that makes a difference...
 
C

Charlton Wilbur

DF> && ( ${kill} == $TRUE ) )

DF> where $kill is a local (my) variable. This produces this:

DF> "Ambiguous use of ${kill} resolved to $kill at ..."

DF> If I remove the {} from around the kill (which are unnecessary
DF> anyway) then the problem goes away. I've never seen that and
DF> it puzzles me. What's it trying to tell me?

There's a builtin function called kill; perldoc -f kill.

${kill} can legitimately be interpreted as either $kill or ${kill()};
Perl is warning you that it's interpreting it as $kill so that if you
really meant ${kill()} you can rewrite that line.

Removing the {} in that case is probably the wise thing to do.

Charlton
 
D

Derek Fountain

There's a builtin function called kill; perldoc -f kill.

So there is. I forgot about that. :eek:} Make perfect sense now...

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top