in reply to Re: comparing size
in thread comparing size

I do not think you gave a good answer. First of all, how to get the size of a file wasn't the question, the question was about comparing values found in a file. Second, if you want the size of a file, no need to remember the order of all the things stat returns. Just use -s.

Abigail

Replies are listed 'Best First'.
Re: Re: comparing size
by gmpassos (Priest) on Aug 19, 2002 at 14:37 UTC
    Sorry, I read fast the question! Here are some code to compare the 2 list of files:

    my %size1 = &size_list('path/to/file1') ; my %size2 = &size_list('path/to/file2') ; if ( $size1{'wirerrrle/pqc/bcgr.o'} == $size2{'wirerrrle/pqc/bcgr.o' +} ) { print "OK\n" ; } ############# # SIZE_LIST # ############# sub size_list { my ( $file ) = @_ ; open (FILEIO,$file) ; my $data = join '' , <FILEIO> ; close (FILEIO) ; my (@list) = ( $data =~ /(\d+)\s+\w+\s+\d+\s+[\d:]+\s+(.*?)\s/gs ); my %sizes ; for (my $i = 0 ; $i <= $#list ; $i+=2) { $sizes{@list[$i+1]} = @list[$i] ; } return( %sizes ) ; }

    "The creativity is the expression of the liberty".