On 9/10/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
snip
> The above is also using the qw// operator, using < and > as the
> delimiters.  This creates a list of single quoted strings.  So if the
snip

And the reason I chose <> is that in Perl 6 qw// is will be replaced
by the diamond operator*.  Also, when accessing a hash with a bareword
(or set of barewords in the case of a slice) you say

%hash<foo> = "bar";

rather than

$hash{foo} = "bar";

When using a string or a variable you still use {} like this

%hash{$key} = "bar";
%hash{'foo'} = "bar";

One upshot of this is that it is much easier to write this Perl 5 code

my %start; @start{qw<month day year>} = split /\//, shift;

as

my %start<month day year> = split /\//, shift;

There is a similar operator named <<>> (or if you prefer unicode «»)
that acts as an interpolating qw//.  So you can say

my $key = "foo";
my %hash<<$key bar baz>> = 1, 2, 3;

and wind up with three keys: foo, bar, and baz.

* the old diamond operator will be replaced by unary = and operates on
all iterators, not just file and directory handles.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to