){ print usage.;exit 1;}
unless ( -f $ARGV[0] ){ print bad file name ;exit 1;}
$n = $ARGV[1]-1 || 9;
- Original Message -
From: Mrtlc [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 10, 2003 11:52 PM
Subject: tail + count
I wrote the following script
I wrote the following script as a windows tail + count function,
but it's too slow if the input is huge, how can it be improved?
if (!$ARGV[0]){
die(you've forgotten to enter the file name\n);
}
if (!$ARGV[1]) {
$n = 9; # output 10 rows by default
}
else {
$n = $ARGV
Mrtlc wrote:
I wrote the following script as a windows tail + count function,
but it's too slow if the input is huge, how can it be improved?
if (!$ARGV[0]){
die(you've forgotten to enter the file name\n);
}
if (!$ARGV[1]) {
$n = 9; # output 10 rows by default
}
else
Hi John
John W. Krahn [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
@ARGV == 2 and my $n = pop || 10;
$n will be undefined if @ARGV != 2. Need something like:
$n = @ARGV == 2 ? pop : 10;
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For