Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Array compare not matching all elements

by cavac (Curate)
on Oct 29, 2018 at 16:06 UTC ( #1224861=note: print w/replies, xml ) Need Help??


in reply to Array compare not matching all elements

You already got some great solutions. Here's my 2 cents:

#!/usr/bin/env perl use strict; use warnings; use diagnostics; use Array::Contains; my @array1 = ("A2","A5","C1","G0","T3","T4"); my @array2 = ("A2","A3","A5","G1","G0","G4"); foreach my $elem (@array1) { print "$elem\n" if(contains($elem, \@array2)); }

Edit: I just love those kind of Perl questions where there are so many different solutions to choose from. Really shows of the flexibility of the language!

perl -e 'use MIME::Base64; print decode_base64("4pmsIE5ldmVyIGdvbm5hIGdpdmUgeW91IHVwCiAgTmV2ZXIgZ29ubmEgbGV0IHlvdSBkb3duLi4uIOKZqwo=");'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2021-02-28 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?