Thanks all!

Jeff: Your answer was the one I needed. (duh! I was so tangled in my own
shorts that I forgot to mention the web page connection -- good catch. <g>)

Steve: While I had tried your solution I wasn't seeing it since my test rig
was printing to a web page -- *NOT* doing straight Perl print output to a
screen. I even tried assigning the ASCII code via chr() to a variable --
both w/ and w/o escaping it, but no luck.

Bret: The "Perlish" behavior I was seeing was anything from:

        $target's value printing as: This is text<> ; or: This is text;
to:
        $target's value printing as: This is textScaler(nnnnnxnn) ## don't remember
the exact numbers shown;

not to mention my paw being slapped for the regular coding transgressions in
between cycles of frustration.

Thanks, again for the quicky response, guys!


John--
[EMAIL PROTECTED]

-----Original Message-----
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 06, 2001 12:41 AM
To: Notabene
Cc: Perl Beginners
Subject: Re: Assigning '<' & '>' as chars to a variable


On Jul 6, Notabene said:

>       $var1   = 'This is text ';
>       $var2   = 'This is more text';
>       $target = $var1.'<'.$var2.'>';

The more common technique is

  $target = "$var1<$var>";

>       This is text <This is more text>
>
>I've tried "escaping" each of the two symbols but with no luck -- so what's
>the trick and what am I doing wrong, here?

You've probably neglected to tell us that you're printing this to a web
browser, where < and > have special meanings (they delimit tags).  To get
these characters to display as literals, you'll have to use &lt; and
&gt; instead of < and >.

You can automate that via:

  use HTML::Entities;
  print encode_entities("He's <that> silly!");

--
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **


Reply via email to