Use a simple iterator.
# Create an iterator... my $reader; if ( $opt{c} ) { open my $fh, '<', $MAILLOG or die "Can't open $MAILLOG: $!"; $reader = sub { <$fh> } } else { my $tail = File::Tail->new( name => $MAILLOG, tail => -1 ); $reader = sub { $tail->read }; } # Use our iterator, however it works... while ( my $line = $reader->() ) { ... }
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re: Looping based on a Conditional
by diotalevi
in thread Looping based on a Conditional
by madbombX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |