On Tue, Apr 16, 2002 at 09:10:14PM +0200, Philip Newton wrote:
> On Mon, 15 Apr 2002 15:50:39 -0500, [EMAIL PROTECTED] (David
> Henderson) wrote:
> 
> > {} doesn't auto-quotify

> It does in the context you mentioned -- hash keys. If Perl(5) can tell
> it's a hash, then it'll auto-quote barewords inside. (Which is why you
> have to say, for example, $foo{+shift} or $bar{USERNAME()} if you want
> to use built-in funcs or 'use constant' declared constants.)

Ah, okay, I guess I used the wrong word.  While {} treats barewords as
quoted strings, it doesn't treat whitespace as quoted.  Therefore, in
the Perl 6 example referred to:

      $x{a  }{b  } = 1;
    $xxx{aaa}{bbb} = 2;
    print   $x{a  }{b  }, "\n";
    print $xxx{aaa}{bbb}, "\n";

$x{a  }{b  } should be equivalent to $x{"a"}{"b"}, but not equivalent
to $x{"a  "}{"b  "}.  Thus, the above would be a compromise keeping
columns lined up but not allowing whitespace immediately before "{".

At least, I think that's how it'll work.  I learn best by trying, rather
than just reading, so I may not have a complete handle on how things
will be changing for Perl 6.

David Henderson
-- 
For news about Trek books and Enterprise, visit Psi Phi!
Star Trek Books: http://www.psiphi.org/cgi/upc-db/
Enterprise Site: http://enterprise.psiphi.org/       <*>

Reply via email to