qball has asked for the wisdom of the Perl Monks concerning the following question:

Goal: Get the byte count of a document located in a given directory.

Directory Path: /opt/backup/test/

File Name: databyqball

End Results: Return the byte count of databyqball.

Any suggestions are greatly appreciated.

qball~"I have node idea?!"

Replies are listed 'Best First'.
Re: Byte Count
by converter (Priest) on Jul 18, 2001 at 00:16 UTC

    Obligatory reminder: -X tests set $! and return undef if the file doesn't exist (and presumably on other system errors, although I haven't tested).

    $filesize = -s $filespec; die "error: $!" unless defined $filesize;


Re: Byte Count
by HyperZonk (Friar) on Jul 18, 2001 at 00:02 UTC
Re: Byte Count
by lhoward (Vicar) on Jul 18, 2001 at 00:03 UTC
    my $size = -s "/opt/backup/test/databyqball";