Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: warning! -- Why?

by haj (Priest)
on May 12, 2022 at 07:05 UTC ( #11143811=note: print w/replies, xml ) Need Help??

in reply to warning! -- Why?

The and is the conditional here. The equal sign = has a higher precendence than and and Perl guesses (it's a warning, not a syntax error) that you meant to have a comparison on its left side. The expression might also not do what you want since the result of and is not its second operand, but I guess you want "\${$1}" as replacement string.

The cleanest (IMO) way to get rid of that warning is to use do, as you did, but to replace the and in the do block with a semicolon:

do { $used_options{ $1 } = 1; "\${$1}" }

Replies are listed 'Best First'.
Re^2: warning! -- Why?
by jwkrahn (Monsignor) on May 12, 2022 at 16:27 UTC


    Yes, I figured this out a couple of hours after I posted.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11143811]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2023-03-24 19:07 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (61 votes). Check out past polls.