in reply to Re: Joining Arrays?
in thread Joining Arrays?
Perl6 provides a pretty handy way to do this. It has X which I beleive is pronounced "cross" so that you can do: (source)
use v6; my @urls = ('http://www.something.com/blah.aspx?code=', 'http://www.somethingelse.com/stuff.aspx?thing='); my @ids = ('375035304','564564774','346464646'); my @combined = (@urls X @ids).map: {$^a ~ $^b}; .say for @combined;
Which outputs the following on Rakudo already:
http://www.something.com/blah.aspx?code=375035304 http://www.something.com/blah.aspx?code=564564774 http://www.something.com/blah.aspx?code=346464646 http://www.somethingelse.com/stuff.aspx?thing=375035304 http://www.somethingelse.com/stuff.aspx?thing=564564774 http://www.somethingelse.com/stuff.aspx?thing=346464646
The $^a and $^b in the map block tell it to take two elements at a time, while the X in the parenthesis tells it to cross join the two arrays. Very very handy for this kind of thing.
___________
Eric Hodges
In Section
Seekers of Perl Wisdom