#!C:\perl\bin\perl
open(TXT, "<sample.txt");
@text = <TXT>;
close(TXT);
print "Content-type:text/html\n\n <html>";
print "Text file contents:<br/>";
foreach $line(@text)
{
print "$line <br/>";
}
print "</html>";
# This will loop through all the line in the file,
# substitute commas with pipes on each line,
# and print the line to STDOUT.
open(TXT, "< sample.txt");
# Loop through each line as they are read
# instead of loading them all first in memory
# to an array, which is double-work.
while (my $line = <TXT>)
{
$line =~ s/,/|/g; # <-- Replace commas!
print $line;
}
close(TXT);
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs