in reply to Re^2: strange scope
in thread strange scope

I find it interesting that so many people jumped on the "you don't want to do an assignment in a conditional" bandwagon without even knowing what the right hand side of the assignment is. There are times when an assignment in a conditional is exactly what you want. Here is an example that I use almost daily with DBIx::Class...

my $rs = $schema->resultset( 'Foo' ); while ( my $record = $rs->next ) { # do something with the record }

The warning you mention only occurs if the right hand side of the assignment is a constant, and the OP didn't include what was in the RHS.


We're not surrounded, we're in a target-rich environment!