in reply to Re: system call: Unix system call result into a variable
in thread system call: Unix system call result into a variable

File::Tail is more for "tail -f" functionality, where you want to keep reading from a continuously updated (i.e. appended to) file. Using backticks (as in your example) or qx is a perfectly acceptable (and simple, efficient) solution.

Replies are listed 'Best First'.
Re^3: system call: Unix system call result into a variable
by cdarke (Prior) on Jul 18, 2007 at 09:05 UTC
    File::Tail may be used like a conventional tail(1) - without the rescan - by specifying the 'tail' argument to the constructor. However to prevent the 'wait' you have to only display those lines you ask for (then destroy the object). For example:
    use strict; use File::Tail; my $num_of_lines = 10; my $tail = new File::Tail (name=>$ERRLOG, tail => $num_of_lines); for (1..$num_of_lines) { my $line = $tail->read(); print "$_: $line"; } $tail = undef;

    update: I emailed the author of File::Tail (Matija Grabnar) with this solution, and he was kind enough to respond immediately with the following:
    "You're wasting most of File::Tails potential, but yes, that should work.
    Note that it won't work if your input is a stream or a pipe (for which ordinary tail would work)."