"Josh Corbalis" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
>
> ---------- Original Message -----------
> From: "LI NGOK LAM" <[EMAIL PROTECTED]>
> To: "Josh Corbalis" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> Sent: Wed, 23 Jul 2003 02:52:16 +0800
> Subject: Re: print command help
>
> > ----- Original Message ----- 
> > From: "Josh Corbalis" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 23, 2003 2:24 AM
> > Subject: print command help
> >
> >
> > In Perl, <> means nothing in string, it only means :
<snip />

the op is having trouble getting a string to render in a HTML browser.

> >
> > open FH, "file.txt"; @lines = <FH>; close FH;
> > it reads all the context to array (@lines) from file.txt,
> > elems are splitted by each \n ( or \r\n ) from file.txt
> >
> > So, what your trying to looking for might be :
> >
> > print `searchtest <gimp> <10>`; # exec a shell command
> > or
> > print "searchtest $val1 $val2";
> >
> > HTH
>
> Actually the value 'searchtest<gimp><10>' is all stored in one variable.
It
> prints the searchtest<10> fine but ignores the <gimp> because ofthe <>
> surrounding it. The variable is printed in a double quoted string

It doesn't _ignore_ that part of the string. The reason why it will not
render in the browser should be obvious to a web developer. The construct
"<gimp>" is a tag, plain and simple.

You mentioned you tried to escape the html metacharacters in the string but
didn't show how you tried to accomplish this. That is where your problem is.
Note:

[EMAIL PROTECTED] trwww]$ perl
use warnings;
use strict;
use CGI;

my($literal) = 'searchtest<gimp><10>';

print( CGI::escapeHTML( $literal ), "\n" );
Ctrl-D
searchtest&lt;gimp&gt;&lt;10&gt;

This will render the string as desired in a browser.

Todd W.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to