\n newline doesn't work in your situation because HTML-rendering browsers don't respect newline characters, except probably within <pre></pre> tags. If you want a new line in general HTML documents, you have to use a HTML tag or set of tags. For example, wrap the text in <p>...</p> tags, or for a line break use <br />.
If you're trying to get tabular data to render in HTML form, your script needs to output the proper HTML to do that too. More often than not, that means using tables. You do that by outputting <table></table><tr></tr><td></td> and so on.. tags, in accordance with proper HTML formatting practices.
Update for clarification:
This actually has a lot less to do with array manipulation than it does with understanding the interplay between a Perl based CGI script, and the client's browser. Think of what you would write in a static HTML web page, and then understand that Perl must output that. If you would write a web page like this:
<head> <title>My page</title> <h1>My page</h1> </head> <body> <p>Hello world!</p> </body>
...then you need your Perl script to output all that, tags and all. If you want the browser to render data in table format, output the html tags for a table, intersperced with the actual data.
Update 2: Sorry, I keep thinking of more to say.
Regarding the use of strictures (use strict;): Strict is basically a tool that helps you to make sure you're not accidentally breaking tried and proven rules of conduct. With strictures enabled you can't, for example, accidentally stumble into the trap of using symbolic references. A misspelled variable or function name will become more easily apparent. And it encourages you to learn to use lexical scoping, or at very least to declare your globals. With time you'll learn more about how it helps you to live a clean and healthy life.
Welcome to the Monastery!
Dave
In reply to Re: Array manipulation
by davido
in thread Array manipulation
by loop362
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |