Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Unsuccessful and Uninitialized Value

by jpeg (Chaplain)
on Jun 05, 2006 at 20:02 UTC ( [id://553682]=note: print w/replies, xml ) Need Help??


in reply to Unsuccessful and Uninitialized Value

Some crude debugging would help. Check to see if the file exists before you stat it, and establish a default value: The uninitialized warning is generated because $new_max is not a number yet.

Here's how I'd do it:

#!/usr/bin/perl use warnings; use strict; my $largestsize = 0; my $size; my $file = "filelist"; open (FILE, "$file") or die $!; while (<FILE>) { chomp; if ( -e $_ ) { $size = (stat($_))[7]; if ($size > $largestsize) { $largestsize = $size; } } } print ("$largestsize \n");
--
jpg

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://553682]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-26 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found