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

Re^4: Search in array from match in another array, print once only.

by garikapati (Initiate)
on Feb 22, 2013 at 11:13 UTC ( #1020137=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Search in array from match in another array, print once only.
in thread Search in array from match in another array, print once only.

just try this one

#!C:\Perl64\bin -w use strict; my @array = ( "54321" , "54312" , "5999" , "54352" , "12345" ); my @original = ( "12345" , "54321" , "12355" ); my $hash={}; foreach my $val(@original){ if (grep{$_ == $val} @array){ $hash->{$val}++; }##end if else { print "$val NOT MATCHED\n"; }##end else }##end foreach foreach (keys(%{$hash})){ print "$_ matched $hash->{$_} times\n"; }##end foreach


Comment on Re^4: Search in array from match in another array, print once only.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (15)
As of 2014-09-02 13:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (22 votes), past polls