Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Concordance Printing of Two Arrays

by gopalr (Priest)
on Oct 17, 2005 at 08:54 UTC ( #500677=note: print w/ replies, xml ) Need Help??


in reply to Concordance Printing of Two Arrays

Hi Eddie,

Use List::MoreUtils Module to do this.

use List::MoreUtils qw(pairwise); use Data::Dumper; my @num = qw (1 2 3 4 5); my @alp = qw (A B C D E); @result=pairwise{($a.'-'.$b)}@num, @alp; print Dumper(\@result);

Output:

$VAR1 = [ '1-A', '2-B', '3-C', '4-D', '5-E' ];

Thanks
Gopal.R


Comment on Re: Concordance Printing of Two Arrays
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://500677]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2015-07-03 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls