Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Compare Values in HoH

by Samy_rio (Vicar)
on Apr 06, 2006 at 09:30 UTC ( [id://541607]=note: print w/replies, xml ) Need Help??


in reply to Compare Values in HoH

Hi AcidHawk, Try this,

This will help you if your files hava datas in rows seprated by ','

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use List::Compare::Functional qw(:originals :aliases); my $file1 = '1141286452,ServerA,Disk Full,Arb data,other,stuff 1141286737,ServerB,Net Down,Arb data,other,stuff 1141286737,ServerC,Disk Full,Arb data,other,stuff'; my $file2 = '1141286452,ServerA,Disk Full,Arb data,other,stuff 1141286737,ServerB,Net Down 1141286780,ServerD,Bit Bucket Missing'; my @file1 = split/\n/, $file1; my @file2 = split/\n/, $file2; map{s/^([^,]+\,[^,]+\,[^,]+)\,(.*?)$/$1/}@file1; map{s/^([^,]+\,[^,]+\,[^,]+)\,(.*?)$/$1/}@file2; my @Comm; my $comm = @Comm = get_intersection( [ \@file1, \@file2 ] ); if ($comm <=> 0) { print "\n\nFollowing informations are present in both File1 & File2.\n +"; print "\t\t\t$_.\n" foreach (@Comm); } __END__ Following informations are pesent in both File1 & File2. 1141286452,ServerA,Disk Full. 1141286737,ServerB,Net Down.

Updated

Regards,
Velusamy R.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-03-28 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found