Guest_imported
New member
- Jan 1, 1970
- 0
Hi everyone,
I need some help here.
I'm trying to create a simple script that performs two tasks.
1. counts the number of lines in a file.
2. displays the total count in a web page.
So, say pet.db contains;
cat
dog
I want to display;
Pets in database: 2
This is the script I,ve got so far;
#!/usr/local/bin/perl
# =====================
# ---------------------
# Record Counter V1.0
# ---------------------
# =====================
my $curr = 1;
open (CURR, "pet.db" or die $!;
$curr++ while (<CURR>);
close CURR;
print $curr;
exit;
}
I use this SSI, <!--#exec cgi="counter.cgi"--> to try and display $curr in a web page.
This should work. But it doesn't !
Is there something I've missed?
Any help welcome.
Thank you.
I need some help here.
I'm trying to create a simple script that performs two tasks.
1. counts the number of lines in a file.
2. displays the total count in a web page.
So, say pet.db contains;
cat
dog
I want to display;
Pets in database: 2
This is the script I,ve got so far;
#!/usr/local/bin/perl
# =====================
# ---------------------
# Record Counter V1.0
# ---------------------
# =====================
my $curr = 1;
open (CURR, "pet.db" or die $!;
$curr++ while (<CURR>);
close CURR;
print $curr;
exit;
}
I use this SSI, <!--#exec cgi="counter.cgi"--> to try and display $curr in a web page.
This should work. But it doesn't !
Is there something I've missed?
Any help welcome.
Thank you.