Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to juggle between two arrays that are not same size

by jrsimmon (Hermit)
on Dec 19, 2007 at 17:24 UTC ( [id://657922]=note: print w/replies, xml ) Need Help??


in reply to How to juggle between two arrays that are not same size

Have you considered a hash?
use strict; use warnings; my %Names = (A => 1, B => 1, C => 1); my %FullRecord = (A_1 => 1, D_4 => 1, C_3 => 1, F_6 => 1, B_2 => 1,); my @DesiredRecord = (); foreach my $el (keys(%FullRecord)) { my @SplitArray=split(/\_/,$el); unshift(@DesiredRecord, $el) if exists $Names{$SplitArray[0]}; } print "@DesiredRecord";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-20 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found