develooper Front page | perl.perl5.porters | Postings from October 2007

Storable issue

Thread Next
October 27, 2007 19:02
Storable issue
Message ID:
I have come across a case where two identical data structrures are   
stored in two different files using the storable module. The only  
thing is the filesizes of these  two files is different, maybe by as  
much as 10%.
Any ideas why this is so?

Spiros Alexiou

> perl destdighash destdighashnew
structures of destdighash and destdighashnew are identical.
Died at line 12.
me@linuxblushingSECUR/KPI> ls -l destdig*
-rw-r--r--  1 me users 8872 2007-10-20 02:00 destdighash
-rw-r--r--  1 me users 7938 2007-10-25 21:25 destdighashnew

here is the script:
use strict;
use Storable;
  use Data::Compare;

my $file1=shift; my $file2=shift;#e.g. destdighash, destdighashnew
if(-e "$file1"){  $main::rdestdighash=retrieve("$file1");}else{die  
"could not find $file1 to get hashref1 from\n";}
if(-e "$file2"){  $main::rdestdighashnew=retrieve("$file2");}else{die  
"could not find $file2 to get hashref2 from\n";}

print "structures of $file1 and $file2 are ",
       Compare($main::rdestdighash, $main::rdestdighashnew) ? "" :  
"not ", "identical.\n";

My only guess as to the size difference is that the original one was  
created on an older(though also linux) system.
  STill , I cannot figure out why this could happen

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About