Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Compare Values in HoH

by Samy_rio (Vicar)
on Apr 06, 2006 at 09:30 UTC ( #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.


Velusamy R.

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://541607]
choroba waves is
[choroba]: 'Tyrol' =~ tr/Ty o/Pe/rd
choroba hates the CB and its space insertion
Eily wondered if the space was there for a reason
[Eily]: like "Replace the T, replace the y, skip one, replace the o"
[Discipulus]: it works anyway, good morning choroba

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2017-07-24 09:15 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (348 votes). Check out past polls.