P.P.P.S. If answer on my "why?" would be "just because!" I would take it silently.

yes, answer was as I predicted above. I promised..

..but:
As far as I understood, arrays and hashes, and references them are much more similar in Perl6 than it was in Perl5.

F.e. we have @a and $a = [EMAIL PROTECTED];
the same:

     push @a,1,2,3   push $a, 1,2,3
     $b = @a         $b = $a
(?)  say "@a[]"      say "$a[]"
(?)  myfunc( [EMAIL PROTECTED])    myfunc ( *$a)

...

were all thoose right?

hm.. i'm not so competent to continue that list.. could anyone kind make a comparison table?

yes, please! I think, answer could be very informative for other readers too. and even could make it's way to perl6 documentation. So, where's @a and [EMAIL PROTECTED] are the same, and where they aren't?


in all other places where they work different, we could use @$a in place of @a, right?

if @ in @a is a part of name, would @$b work? and what's that @ here, behind the scenes? operator? macro?


...
P.P.P.P.S
  open $file, "filename";
  print @file;
...

..er, in that case: open $file, "filename"; print @$file;

i mean, what about using objects(files, iterators, etc) as arrays? AFAIK, we will have custom subscripting defined on our objects, so $file[10] could be made to work, but what about @$file, or @($file) or $file[] (um, maybe $file[*], I forgot) would it make any sense?

and, one more question: if we would have both tying (arrays which call hidden object methods) and objects which could act as array references, where's a difference between them? could it be THE same? Should it? could we write
my $a = new ArrayLikeClass;
my @b := @$a;
or
my @b := $a;
(which one is right?)

Reply via email to