Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1020137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2025-03-25 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (65 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.