ebudihar wrote:
>Dear all,
>I am sorry bugging you guys again.
>I got a perl file and data file. When I tried to run it through IE, it does
>not display the contents of the data file instead of it open the perl script
>file itself in notepad.
>Please help me how I can read my data file by my perl script and display it
>into a browser.
>
>------
>Perl Script
>
>#!/usr/bin/perl
>
>$data_file="data.txt";
>
>#reading a file
>open(DAT, $data_file) || die("Could not open file!");
>@raw_data=<DAT>;
>close(DAT);
>
>print "Content-type: text/html\n\n";
>print "<HTML><BODY>";
>
>foreach $wrestler (@raw_data)
>{
> chop($wrestler);
> ($w_name,$crowd_re,$fav_move)=split(/\|/,$wrestler);
> print "When $w_name is in the ring, the crowd might $crowd_re when the
>$fav_move is used.";
> print "<BR>\n";
>}
>
>print "</BODY></HTML>";
>
>------
>Data file
>
Try that:
#!/usr/bin/perl
use strict;
# The file of the data should be located in one place with perl-script
my $data_file="data.txt";
my @raw_data;
open(DAT,"$data_file") || die("Could not open file!");
@raw_data=<DAT>;
close(DAT);
print "Content-type: text/html\n\n";
print "<HTML><BODY>\n";
foreach my $wrestler (@raw_data)
{
chop($wrestler);
my ($w_name,$crowd_re,$fav_move)=split(/\|/,$wrestler);
print "When $w_name is in the ring, the crowd might $crowd_re when the
$fav_move is used.";
print "<BR>\n";
}
print "</BODY></HTML>";
### END ###
---
Best regards
AlexBel
_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs