On Fri, Aug 17, 2001 at 11:52:09AM -0400, Chris Devers wrote:
> On Fri, 17 Aug 2001, Daniel R. Allen wrote:
> > 
> > I did find out that as of perl5.6 you can have variable names such as
> > ${^Hi} where the ^H is actually 'ctrl-h'.
> > 
> > But I'm not sure why this is useful.
> 
> My guess would be for forward compatibility with Unicode / non-western 
> languages. Ctrl-H, or "^Hi" might map to a perfectly reasonable character 
> in Arabic or Japanese or whatever. 

Nothing so elegant, I'm afraid.  I think they just ran out of control
characters to use for special variables and decided to allow more than
one char in the names.

Originally (my theory goes), things like $^W had to be entered with a
real ctrl-W.  Then people got annoyed with funny things happening to
their terminal modes when they catted their scripts, so they made ^X
(caret + X) equivalent to Ctrl-X in names.  Then they wanted names
like ${^WARNINGS}, and whether out of nostalgia or malice, they made
Ctrl-W + ARNINGS work the same as ^WARNINGS.  Internally it's even
stored with the Ctrl-W, I believe.

-John

Reply via email to