help can't print " ";

They have: 11 posts

Joined: Nov 1999

If I comment out the open statment below I can print, but if don't comment it out nothing prints, and I get no errors when I run it, just a blank screen.

Also I can't print any data that is supposedly read in from the file. Am I doing something wrong? Where did the data go? I can't print any data from the file either.

Thanks,
Aaron

#!/usr/local/bin/perl

print "Content-Type: text/html\n\n";

open($AFILE, "<data.txt");
print "$_";
print "this is atest";
while (<$DATA_FILE> ) {
chop;
($field1,$field2) = split(/:/$_,2);
$data_array{$field1} = $field2;
} #end while

They have: 850 posts

Joined: Jul 1999

one thing I noticed is that you have no
close(AFILE);

Try somthing like this
open(IN,"<file.txt");
while(<IN> )
{
$line=<IN>;
chomp($line);
print "Content-Type: text/html\n\n";
print $line;
($field1,$field2)=split(/:/,$line);
$data_array{$field1} = $field2;
} #end of while
close(IN);
------------------
If you counted 24 hours a day, it would take 31,688 years to reach one trillion.

[This message has been edited by robp (edited 01 December 1999).]

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.