in reply to Re^5: Warnings on unused variables?
in thread Warnings on unused variables?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Warnings on unused variables?
by ikegami (Patriarch) on Sep 28, 2008 at 00:58 UTC | |
by AZed (Monk) on Sep 28, 2008 at 02:01 UTC | |
by ikegami (Patriarch) on Sep 28, 2008 at 02:46 UTC | |
by AZed (Monk) on Sep 28, 2008 at 05:33 UTC | |
by ikegami (Patriarch) on Sep 28, 2008 at 06:57 UTC | |
|
Re^7: Warnings on unused variables?
by ikegami (Patriarch) on Sep 28, 2008 at 00:52 UTC |