CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [stuckinarut] Modify script to compare and flag lists: Edit Log



stuckinarut
User

Jun 9, 2014, 12:21 AM


Views: 43979
Re: [stuckinarut] Modify script to compare and flag lists

Still plodding away and tried a script for another task here using a Hash that had some issues - like the output contained a lot of random blank lines. But it was worth a try to run the L and H lists, and then take that result and run it with the A list (changing xxxL to xxxL2 in the code) ... in spite of their being the previous "Reverse" stuff involved.


Code
#!/usr/bin/perl 

use strict;
use warnings;

my ( $xxxL, $xxxH, %hash, $reverse ) = @ARGV;

while (<>) {
my @fields = $reverse ? reverse split : split;
$hash{"@fields"}{$ARGV}++;
$reverse++ if eof;
}

for my $key ( sort { ( split ' ', $a )[0] cmp ( split ' ', $b )[0] } keys %hash ) {
print $key if exists $hash{$key}{$xxxL};
print ' H' if keys %{ $hash{$key} } == 2;
print "\n";
}


Importing the result into Excel and group deleting the blank lines netted the original 2,845 xxxL list ID's which was good. And both {space} H and {space} A flags showed up adjacent to a number of entries. What I do NOT know is how accurate this all turned out unless I manually compare all 3 lists (2,845 + 735 + 699 entries). Ugh ;-(

How to re-tweak the code to nuke the "Reverse" stuff and use all 3 lists at once has me baffled, however at least there seems to now be some proverbial "light at the end of the tunnel."

- stuckinarut


(This post was edited by stuckinarut on Jun 9, 2014, 12:22 AM)


Edit Log:
Post edited by stuckinarut (User) on Jun 9, 2014, 12:22 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives