Well, it may not be the ideal solution but just for the record I got it to work.
I used a scalar to contain the correect value: $pound = chr 156; Then used unshift to add it to the array. unshift @array, $pound; Seems to have done the trick which is all I was after. Cheers for the help, I'm sure I'll be back soon. Mark >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of zentara >Sent: 18 April 2006 20:13 >To: beginners@perl.org >Subject: Re: beginner help > >On Tue, 18 Apr 2006 13:37:11 +0100, [EMAIL PROTECTED] ("M K >Scott") wrote: > >>I am just starting out teaching myself Perl from books and web >>resources so I apologise if my questions seems a little straight >>forward but I was hoping to ask here to get clarification and >so I hope >>my simple questions do not annoy you all and that I have the right >>forum for these questions :) >> >>I am trying to initialise an array with certain characters in >it to then match to user input but the '£' symbol is coming up >in the comparison as a funny looking 'u symbol with a squiggle >above. Is this due to me being inept at programming or my PC >not understanding the pound sign? >> >>I am using a simple: @arrayname = qw($ £ * & ! #); >> >>Any comments on what I need to do or am doing wrong? > >You are experiencing one of the biggest problems facing modern >computing ... encoding, internationalization, and how to handle it. > >I'm really an encoding novice myself, so you might want to ask >at http://perlmonks.org, where alot of encoding experts hang out. > >You might want to read: >http://www.ahinea.com/en/tech/perl-unicode-struggle.html > >you can google for 100's of other writeups on the problem. > >One possible solution, would be to convert to hex, and compare >hex values. But like I said, I'm guessing, and I'm hampered further >by my editor in Midnight Commander not working well with utf8. :-( > >You have to decode your @array for this to work, otherwise >you will get a c2, instead of a3. > >It would be so much easier if the whole world would just >switch to American English :-) > >#!/usr/bin/perl >use warnings; >use strict; >use Encode; > >my $euro = "\x{A3}"; > >my @array = qw($ £ * & ! #); >print "@array\n"; > >foreach (@array){ > $_ = decode( 'utf8', $_ ); >} > >print "@array\n"; > >my @hex = map { sprintf '%02x', ord $_ } @array; print "@hex\n"; > >print $euro."\n"; > >#these match as hex >my $in = sprintf '%02x', ord ($euro); >print "$in\n"; > >my $in1 = sprintf '%02x', ord ($array[1]); print "$in1\n"; __END__ > > > >-- >I'm not really a human, but I play one on earth. >http://zentara.net/japh.html > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] ><http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>