Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

outputting data into html using CGI

Status
Not open for further replies.

dulux

Programmer
Sep 4, 2002
36
0
0
GB
Hi all,

I am writing a CGI script that outputs some HTML. This is quite easy for me, apart from the following...

Before I output the HTML, I call a function and pass its results to an array - @array=function();

I would like to print the contents of this array in the HTML page, but either end up printing hexadecimal values or the code itself.

I thought something like 'print @array[1]' would be appropriate, but it isn't.

Any ideas?

Thanks
 
Hi

Try "print $array[1]" instead (ie using $ not @ in the print line)

Also remember that PERL arrays are "zero based" (First index is 0).

Good luck!
 
Thanks for the quick reply.

The thing is still not working, however. I kind of know how to print from an array under a text based environment, but I cannot print the contents of this array under HTML. This may actually be more of a HTML question than a perl one, but I am sure someone here must have done this before...

Your continued help is always appreciated.


 
I've managed to sort it out.

I have discovered a module called Mason.

This module enables perl to be included within HTML and then output the results as accordingly. The perl is encased within the HTML using <%perl> at each end. Any perl code can be included.

Thanks for the help anyway...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top