JonnyRed77
Programmer
Hi there. I'm trying to read info from a text file & store it in an array. Each bit of info is seperated by a ",". I tried using the split function to seperate them but will not work. When I go to print out the array, it just prints out my file location as a string rather than printing the file info. Writing to the file is fine, just can't read from it. Any help would be great.
John
-------------------------------------------------
Come visit my website
------------------------------------
John
-------------------------------------------------
Code:
sub process_form {
$surname = param('Surname');
$forename = param('Forename');
$exnumber = param('ExNumber');
$email = param('Email');
$department = param('Department');
$FullName = "$surname" . "_" . "$forename";
$TesterFile = "c:/progra~1/apache~1/apache/bin/list.txt";
open(LIST, ">>$TesterFile") || die "Can't open file: $!";
if ($email =~ m/@/) {
print LIST "$FullName,$exnumber,$email,$department\n";
}
close LIST;
open(LIST, "<$TesterFile") || die "Can't open file: $!";
# PROBLEM IS HERE
@FileContents = split(/,/, $TesterFile);
close LIST;
print header, start_html( {-title=>'Beta Testers Application Results'} );
print "$list[0]";
print end_html;
}
Come visit my website
------------------------------------