jwkrahn has asked for the wisdom of the Perl Monks concerning the following question:
sub process_variables { my ( $value, $remove_undef ) = @_; $value =~ s/ (?<! \\ ) \$ \{ ( .*? ) \} / defined $variable{ $1 } ? $variable{ $1 } : defined $remove_undef && $remove_undef # for if statements, any variable that is not defined, # we simple convert to 0 ? '0' # This could be an option that is used later, save # it so we don't warn if this option is not one of # ktests options. And put back the origin piece. : ( $used_options{ $1 } = 1 and "\${$1}" ) /exg; return $value; }
The code above produces the warning message:
Found = in conditional, should be == at file line n.
If I change:
( $used_options{ $1 } = 1 and "\${$1}" )
To:
do { $used_options{ $1 } = 1 and "\${$1}" }
I still get the same warning message.
But obviously the message is wrong because there is no = in conditional.
$ perl -v This is perl 5, version 24, subversion 1 (v5.24.1) built for x86_64-li +nux-gnu-thread-multi (with 90 registered patches, see perl -V for more detail) Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: warning! -- Why?
by haj (Vicar) on May 12, 2022 at 07:05 UTC | |
by jwkrahn (Abbot) on May 12, 2022 at 16:27 UTC | |
|
Re: warning! -- Why?
by Athanasius (Archbishop) on May 12, 2022 at 07:14 UTC | |
by jwkrahn (Abbot) on May 12, 2022 at 19:09 UTC | |
|
Re: warning! -- Why?
by Tux (Canon) on May 12, 2022 at 06:59 UTC | |
|
Re: warning! -- Why?
by hippo (Archbishop) on May 12, 2022 at 08:54 UTC | |
|
Re: warning! -- Why?
by kcott (Archbishop) on May 12, 2022 at 09:37 UTC |