Error puzzler

2006-09-13 Thread Peter Scott
Here's a distillation of something that just bit me, behaves the same on 5.6.1 and 5.8.5. Observe the following program: for (1..2) { print_file($0); } for (qw(one two)) { print_file($0); } sub print_file { local @ARGV = shift; while (<>) { print } } __END__ Before running it, can you

Re: Error puzzler

2006-09-13 Thread Uri Guttman
> "PS" == Peter Scott <[EMAIL PROTECTED]> writes: PS> Here's a distillation of something that just bit me, behaves the same on PS> 5.6.1 and 5.8.5. Observe the following program: PS> for (1..2) { PS> print_file($0); PS> } PS> for (qw(one two)) { PS> print_file($0); PS> }

Re: code line of the day

2006-09-13 Thread Bart Lateur
On Fri, 8 Sep 2006 08:19:21 -0700 (PDT), John Douglas Porter wrote: >If you really want to test the ref type, do so >robustly using the methods in Scalar::Util. I'm not convinced that is indeed the best approach. So Uri expects either a plain string, or a scalar ref to a string. What if instead

Re: code line of the day

2006-09-13 Thread John Douglas Porter
Bart Lateur <[EMAIL PROTECTED]> wrote: > On Fri, 8 Sep 2006 08:19:21 -0700 (PDT), John Douglas Porter wrote: > > >If you really want to test the ref type, do so > >robustly using the methods in Scalar::Util. > > I'm not convinced that is indeed the best approach. > . . . > Thus: treat only an u