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}" }
In reply to Re: warning! -- Why?
by haj
in thread warning! -- Why?
by jwkrahn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |