Michael Alipio wrote:

I wanted to extract the start time of a particular logfile (located at the
beginning of the file, and also the end time which is located at the end of
the logfile.

Is there any way to do this in perl without using "head" or "tail" commands?

To read a file backwards, you could make use of File::ReadBackwards. The code
below assumes that you log file is called 'logfile'.

use strict;
use warnings;

use File::ReadBackwards;

my $fh = File::ReadBackwards->new('logfile');

my $last_line = $fh->readline;


> By the way, can you point me somewhere perhaps a perl function that lets you
> create directories?

To create a directory use the mkdir() built-in function. It may be more
convenient to use the File::Path module, which provides a mkpath() function
which will also create any intermediate necessary to form a complete path. (It
also offers an rmtree() function.)

HTH,

Rob


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to