andreas1234567 has asked for the wisdom of the Perl Monks concerning the following question:
I just wonder since, after all, it does what I mean without warnings and my:$ perl -l use strict; use warnings; my $i = undef; $i = $_ for (1 .. 3); ($i) ? print $i : warn "pre-defined - missing"; my $j = $_ for (1 ..3); ($j) ? print $j : warn "direct - missing"; __END__ 3 direct - missing at - line 9.
For the record:$ perl -l $j = $_ for (1 ..3); ($j) ? print $j : warn "no warnings - missing"; __END__ 3
This is perl, v5.8.5 built for i386-linux-thread-multi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Assign in loop with and without declaration
by ikegami (Patriarch) on May 22, 2008 at 08:56 UTC | |
by andreas1234567 (Vicar) on May 22, 2008 at 09:35 UTC | |
by Anonymous Monk on May 22, 2008 at 09:53 UTC | |
by andreas1234567 (Vicar) on May 22, 2008 at 10:34 UTC | |
by rir (Vicar) on May 22, 2008 at 14:51 UTC | |
|
Re: Assign in loop with and without declaration
by Anonymous Monk on May 22, 2008 at 08:19 UTC | |
|
Re: Assign in loop with and without declaration
by mwah (Hermit) on May 22, 2008 at 08:26 UTC | |
|
Re: Assign in loop with and without declaration
by runrig (Abbot) on May 22, 2008 at 16:19 UTC |