in reply to using the stat function
I need to make it say KB at the end if its over 1000 and then if its not BytesYou may also want your code to work as you re-assign @stats in every iteration of the foreach loop. Here's a modification of your code to nudge you in the right direction
foreach my $line (@userfiles) { my $size = (stat("$user{'site_id'}/$line"))[7]; my $readable; if($size >= 1024) { $readable = sprintf("%2.2fKB", $size / 1024); } else { $readable = $size . "Bytes"; } print "$line size is: $readable", $/; }
_________
broquaint
|
|---|