in reply to using the stat function

Well, I'm not very good, but:
if ($stat[7] <1000) { print "$stat[7] bytes" } else{ print $stat[7]/1000 ." KB" }
does that work? I don't think there's 1000 bytes in a KB though, but I can't remember the exact number.

Replies are listed 'Best First'.
Re^2: using the stat function (data unit sizes)
by atcroft (Abbot) on Jun 12, 2002 at 13:08 UTC

    This has actually started to become a source of confusion. In data processing, traditionally the kilo-, mega-, giga-, tera-, etc., extensions were powers of 1024, not 1000 (1, 2, 3, 4, etc., respectively), although recently there seems to be a push to force these to be used in the SI (metric) respect of being powers of 1000. This results in a difference of 24 bytes per K, 48,576 bytes per M, 73,741,824 bytes per G, etc.

    According to the IEC International Standard definitions (1998), the units we traditionally think of KB, MB, GB, TB, etc., are now technically KiB, MiB, GiB, TiB, etc.

    So the number you were thinking was 1024, although you managed to be correct both in actual number you suggested, and in your thought about another value.

Re: Re: using the stat function
by Anonymous Monk on Jun 12, 2002 at 14:09 UTC
    well now what if I want stat9 which is the time, and I just wanted to display the date.