From:                   "Beginner" <[EMAIL PROTECTED]>
> On 9 Nov 2007 at 20:04, Jenda Krynicky wrote:
> > @[EMAIL PROTECTED] = map [$valone[$_], $valtwo[$_]] (0..$#valone);
> > 
> > 
> > The map produces a list of arrayrefs, each referenced array contains
> > one item from @valone and one from @valtwo. The 0th element of the
> > result, the 0th elements of @valone and @valtwo, etc.
> 
> Now there you go again with a beautifully simple use of map that does 
> exactly what I want (do you need a comma before (0..$#valone)?).

Yes, I was missing a comma. I usually use the 
        map {} (list)
format that doesn't require the comma ... this is what happens if I 
change the habbits and don't test my code :-)
 
> I notice now that I wrote my example wrong. Each array was meant to 
> have 4 items in (sorry Rob). So it should have been
> 
> my @valone = 1..4;
> my @valtwo = 11..14;
> 
> There seems to be a bit of confusion over what I was trying to 
> achieve. I typed out the output from Dumper I was expecting because I 
> was/am not entirely sure what terms to use. The above operation looks 
> like a hash slice to me albeit with another operator (map) involved.

Yep, the "Dumper output" was exactly the right thing to use :-)

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to