>>>>> "p" == pablo  <pa...@compugenic.com> writes:

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

  p> 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:

  p> Snippet:
  p> if ( $bytes > $sizes{$ext}->{largest} ) {

you use 'largest' there. assuming that isn't ever set, this compares
bytes to undef. this would have been detected if you had enabled
warnings. this is why we always say to make your code warnings
clean. there is a reason for this!

  p>     print "$bytes is larger than $sizes{$ext}->{largest_size}\n";
  p>     $sizes{$ext}->{largest_size} = $bytes;

and 'largest_size' in those two lines.

uri

-- 
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