On Mon, Mar 16, 2009 at 12:23, Jim Gibson <jimsgib...@gmail.com> wrote:
snip
>> Can't call method "x" without a package or object reference at test.pl line 
>> 12
>> <ENT> line 1
snip
>> $ent{$1} = \x{$2};
snip
> Without seeing all of your data, it is impossible to tell what actually went
> wrong. Possibly the next line after 'aacute 00E1' did not match, perhaps
> because it was blank or contained something other than one space between
> entries.
snip

It isn't a data problem.  Perl thinks he/she is trying to take the
reference of the item returned by a call to the function x[1] with a
malformed hashref (not an even number of list items).  This is because
the \x{} construct is only valid in strings.  He/she also has a
problem in that the \x{} does not interpolate values, it requires a
hexadecimal constant.  The right answer is the use hex to get the
decimal value of the hexadecimal string he gets from the regex (which
you rightly point out needs to have guards) and to feed that decimal
value into the chr function to get the UNICODE character he/she is
looking for.

1. If a function x had existed he/she would have gotten a completely
different error message (i.e. the one about the malformed hash).

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to