good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: print file in cgi with perlby dga (Hermit) |
on Jul 23, 2003 at 16:02 UTC ( [id://277227]=note: print w/replies, xml ) | Need Help?? |
Your do is passed along to print as a list which takes the list, inserts a space between the items, and prints it out. Also since you are assiging a value to $i it is passed along to print to be printed also. Additionally, you are loading the entire file into your programs memory space and then tossing all but the first 30 lines.
I tried to make this example similar in spirit to the original. This method only reads the first 30 lines and only uses memory for one at a time. The file you are printing is not html though so it will still not look right at all in a browser. You may want:
This will print the contents as a text file in which the line breaks and spacing from the file will be preserved.
In Section
Seekers of Perl Wisdom
|
|