Front page | perl.perl6.language |
Postings from September 2005
\(...)?
Thread Next
From:
Ingo Blechschmidt
Date:
September 6, 2005 10:50
Subject:
\(...)?
Message ID:
dfkkmh$q36$1@sea.gmane.org
Hi,
# Perl 5
my @array_of_references = \($foo, $bar, $baz);
print 0+@array_of_references; # prints 3
print ${ $array_of_references[1] }; # prints $bar
# Perl 6
my @array = \($foo, $bar, $baz);
say +@array;
# 3 (like Perl 5)?
# Or 1, making \(...) similar to [...]?
If \(...) still constructs a list of references, are the following
assumptions correct?
\(@array); # same as
\@array;
# (As () is only used for grouping in this case.)
# Correct?
\(@array,); # same as
map { \$_ } @array;
# (As &postcircumfix:{'\\(', ')'} is called here.)
# Correct?
--Ingo
--
Linux, the choice of a GNU | Row, row, row your bits, gently down
generation on a dual AMD | the stream...
Athlon! |
Thread Next
-
\(...)?
by Ingo Blechschmidt