in reply to Amazing syntax of push (was Re: Removing duplicates in Array of Array)
in thread Removing duplicates in Array of Array
Seems you do not need either push or anonymous arrays to see the behaviour with 5.8.6:
c:\test>perl -Mstrict -MData::Dump=pp -wle"my @r=1..10; @{ @r }='a'..'c'; pp \@r" ["a", "b", "c"]
@{ @r } seems to function exactly the same as either @r alone (or @{ \@r }). Which is somewhat bizarre.
But not so with 5.10
c:\test>\perl510\bin\perl -MData::Dump=pp -wle"my @r=1..10; @{ @r }='a'..'c'; pp \@r" [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] c:\test>\perl510\bin\perl -Mstrict -MData::Dump=pp -wle"my @r=1..10; @{ @r }='a'..'c'; pp \@r" Can't use string ("10") as an ARRAY ref while "strict refs" in use at +-e line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Amazing syntax of push (was Re: Removing duplicates in Array of Array)
by parv (Parson) on Sep 04, 2008 at 07:58 UTC |