Re: [Boston.pm] Odd behaviour in foreach

2007-01-11 Thread Stephen McCamant
> "DB" == Dan Boger <[EMAIL PROTECTED]> writes: DB> This code was just written to see how things work. I find that DB> understanding these kind of edge cases helps overall. In this case, I think you've stumbled across a known bug, so while it does reveal some implementation details of

Re: [Boston.pm] Odd behaviour in foreach

2007-01-11 Thread Bob Rogers
From: Dan Boger <[EMAIL PROTECTED]> Date: Wed, 10 Jan 2007 14:06:04 -0500 On Wed, Jan 10, 2007 at 01:14:43PM -0500, Uri Guttman wrote: > > "DB" == Dan Boger <[EMAIL PROTECTED]> writes: > > DB> @headers = ("header 1","header 2","header 3"); > DB> @body = ("body A",

Re: [Boston.pm] Odd behaviour in foreach

2007-01-10 Thread Greg London
> @headers = ("header 1","header 2","header 3"); > @body = ("body A","body B","body C"); > foreach (@headers,"",@body) { >@body = (); >push @headers,"header ".$h++; > Ouch. Bad programmer. No biscuit! ___ Boston-

Re: [Boston.pm] Odd behaviour in foreach

2007-01-10 Thread Dan Boger
On Wed, Jan 10, 2007 at 01:14:43PM -0500, Uri Guttman wrote: > > "DB" == Dan Boger <[EMAIL PROTECTED]> writes: > > DB> @headers = ("header 1","header 2","header 3"); > DB> @body = ("body A","body B","body C"); > DB> $h = 4; > DB> foreach (@headers,"",@body) { > > the list of a

Re: [Boston.pm] Odd behaviour in foreach

2007-01-10 Thread Uri Guttman
> "DB" == Dan Boger <[EMAIL PROTECTED]> writes: DB> @headers = ("header 1","header 2","header 3"); DB> @body = ("body A","body B","body C"); DB> $h = 4; DB> foreach (@headers,"",@body) { the list of aliases is created there. it can't be changed by clearing @body. the aliases r

[Boston.pm] Odd behaviour in foreach

2007-01-10 Thread Dan Boger
I was talking to a friend about foreach aliasing the loop variable one by one through the list provided... As he was playing around with it, came across this: use Data::Dumper; @headers = ("header 1","header 2","header 3"); @body = ("body A","body B","body C"); $h = 4; foreach (@headers