I'm having trouble printing the last ten lines from a text file to another text file. It works until it gets to the line 20 and I get this error...
Use of uninitialized value in string at e:\0\74\38\237038\user\240783\htdocs\mywebs\ETbyrne\cgi-bin\redalert\ten_newest_maps.pl line 20.
here's my script:
Thanks for all help.
_______________________________________
You don't know me.
Use of uninitialized value in string at e:\0\74\38\237038\user\240783\htdocs\mywebs\ETbyrne\cgi-bin\redalert\ten_newest_maps.pl line 20.
here's my script:
Code:
#!/usr/bin/perl
use warnings;
use strict;
use CGI qw(:standard);
use Fcntl qw(:flock :seek);
open(FILE, ">>./mywebs/ETbyrne/redalert/links.txt") or die "Can not open links.txt: $!";
seek(FILE,0,0);
my @file = <FILE>;
@file = reverse(@file);
close FILE;
open(FH, "+<./mywebs/ETbyrne/redalert/newmaps.txt") or die "Cannot open newportals.txt: $!";
flock(FH,LOCK_EX);
seek(FH,0,SEEK_SET);
truncate(FH,0);
seek(FH,0,SEEK_SET);
print FH "$file[$_]" for (0..9); # This is line 20 #
close (FH);
print "<html><head><title>Thank You</title></head>\n";
print "<body>\n";
print "Your Map was added. click <a href=\"index.shtml\">here</a> to go to the home page.<br>\n";
print "</body></html>\n";
_______________________________________
You don't know me.