I have a script that tells me the largest file (in bytes) for each
extension.  I store the largest size in a hash, keyed by the extension.

The numeric comparison portion is clearly not working, since it is returning 
true every time regardless of the numbers being compared.  Here's a snippet, 
along with the output shown:

Snippet:
if ( $bytes > $sizes{$ext}->{largest} ) {
    print "$bytes is larger than $sizes{$ext}->{largest_size}\n";
    $sizes{$ext}->{largest_size} = $bytes;
}
else {
    print "$bytes is smaller than $sizes{$ext}->{largest_size}\n";
}
                                            
Output:
304785408 is larger than 
407666688 is larger than 304785408
595656704 is larger than 407666688
597778432 is larger than 595656704
568844288 is larger than 597778432
157255680 is larger than 568844288
512342016 is larger than 157255680
616058880 is larger than 512342016
728705024 is larger than 616058880
6008832 is larger than 728705024

Notice that last line?  Am I missing something obvious, or is there
something wrong here?


Pablo

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to