Just tested, using the same code I used earlier, substituting in each new eval block one at a time without using exit(), i.e.:
#!/usr/bin/perl use warnings; use warnings::unused; use strict; my $foo = 42; my $bar = 43; eval '$'.'foo++';
Result for eval '$'.'foo++':
Unused variable my $bar at ./warntest.pl line 8.
Result for eval 'print q{$foo++}':
Unused variable my $foo at ./warntest.pl line 7. Unused variable my $bar at ./warntest.pl line 8. $foo++%
(the % is inverted on my terminal, and is a lack-of-newline marker)
Result for eval '$cond ? $foo : $bar': (blank).
Double-checking that my original example didn't cause a funny result because I wrapped it in exit, I checked eval q[$foo++];
Unused variable my $bar at ./warntest.pl line 8.
So it looks like it does what you'd expect, other than the first example, and more or less exactly what I want.
In reply to Re^6: Warnings on unused variables?
by AZed
in thread Warnings on unused variables?
by AZed
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |