Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by jrsimmon (Hermit)
on Dec 19, 2007 at 17:24 UTC ( #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? | Other CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2023-06-04 23:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (22 votes). Check out past polls.

    Notices?