Re: Perfecting index.pl some more!



Tassilo v. Parseval wrote:

By using 'for $data', $data gets aliased to $_ which is the default
variable that s/// and tr/// act upon. By using 'for' as a
statement-modifier (that is: in postfix notation) no block is needed
which would normally be the case if you wrote:

    for ($data) {
	s/\n/\\n/g;
	s/"/\\"/g;
	tr/\cM//d;
    }

Aaah, now i get it! This i can understnad thank you.
The reason iam writing this is because i have to pass the variable $data to the upcoming javascript code:


print <<ENDOFHTML;
<html><head><title></title>
<script type='text/javascript'>

var textToShow = "$data";
{snip more code]


$data is supposed to hold all the contents of the user_selected_file that he previously choosed to see from a drop down menu:


If i dont then substitune that chars then js wont work and the file will not be displayed at all.

you can see how js is functioning at my home webpage http://www.nikolas.tk

With your help the index.pl script is getting better & better and i thank you all for that. :-)
.