Rob Dixon wrote:
ChrisC wrote:
I need to print the COPYRIGHT symbol.  How to go about it?  Tried
playing with the following:

my $text;
$text = chr(hex(0xa9));
print "CR *$text*\n";

But the script just dies.

The hex() function expects a string, but you are giving it 0xa9, which is 129,
and chr(hex('129')) is a wide character. Use

  $text = chr(hex('0xa9'));

or

  $text = chr(hex('a9'));

or

  $text = chr(0xa9);

Or:

use Encode;
use charnames ':full';

$text = encode 'utf8', "\N{COPYRIGHT SIGN}";



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to