in reply to Re: Getting an unknown error
in thread Getting an unknown error

Arguably, the lack of a warning is a bug here (at the very least).

Note that the dynamic scoping of $1 appears to be a property of the scalar as well. Masking it over will break pretty much anything called from within that loop, but not only—signal handlers break too.

$SIG{ALRM} = sub { "Yes" =~ /.*/; print "$&\n"; }; for $& ("No!") { alarm (1); sleep 2; }

Replies are listed 'Best First'.
Re^3: Getting an unknown error
by ikegami (Patriarch) on Apr 27, 2015 at 01:18 UTC

    As far as I'm concerned, anything other than for my $var (LIST) and for $_ (LIST) should be avoided. But it's probably best if enforced by perlcritic rather than warnings.

    Honestly, it's rather obvious that $1 is special. If you start mucking with special vars, you get what you deserve.