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: Beginner: Re: [FishMonger] Compare unchanged files in two arrays: Edit Log



StarkRavingCalm
User

Jan 9, 2013, 10:34 AM


Views: 3230
Re: [FishMonger] Compare unchanged files in two arrays

Thanks, that works great!
Need to play with the formatting a little if possible but that's not important.

So...
If I wanted to compare each of the two hashes, what it the best way to accomplish this:
'where value of keys are same write results to a list? array?'
since I only want the filenames (keys), is an array the best way to represent this in perl?

(I know you recommended MD5, but I want to try out each option and use each one as a learning opportunity)


UPDATE:

I found this code to compare the two:
Just need to tie it together...


for ( keys %hash1 ) {
unless ( exists $hash2{$_} ) {
print "$_: not found in second hash\n";
next;
}

if ( $hash1{$_} eq $hash2{$_} ) {
print "$_: values are equal\n";
}
else {
print "$_: values are not equal\n";
}
}


(This post was edited by StarkRavingCalm on Jan 9, 2013, 11:42 AM)


Edit Log:
Post edited by StarkRavingCalm (User) on Jan 9, 2013, 10:51 AM
Post edited by StarkRavingCalm (User) on Jan 9, 2013, 11:42 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