Thanks for the reply, jwkrahn! I'm still not sure how to work this into a charnames alias list, though. This:
#!/usr/bin/perl
use charnames ":alias" => { map { $_ => $char++ }
'first character',
'second character',
'third character'
};
printf "First: %X; third: %X\n",
ord("\N{first character}"),
ord("\N{third character}");
produces the error:
Unknown charname 'first character' at ./mytest line 10, within string
Execution of ./mytest aborted due to compilation errors.
So it accepts the syntax of the alias setup, but doesn't actually create the aliases.
If you're suggesting I use your assignment statement as written and then use your $characters variable to do the alias setup, I can't even find the right syntax for that. This gives syntax errors on the use charnames line, as I would expect (as did a couple variants I tried):
#!/usr/bin/perl
$characters = { map { $_ => $char++ }
'first character',
'second character',
'third character'
};
use charnames ":alias" => $characters;
|