in reply to Re^3: Array/List Strangeness (why)
in thread Array/List Strangeness

Sorry, multi-value slices require more complex syntax: @{[1,2,3]}[8,1,9]. The -> only works when you just want one value back. The @{ } form isn't actually much more verbose, but it is rather uglier. There was a patch to allow [...]->@[...] syntax (and I believe there is even a fork of Perl5 that includes such a patch) but it never got applied to official Perl 5 (I don't think I ever saw a good reason given for why it shouldn't be applied, though).

- tye        

Replies are listed 'Best First'.
Re^5: Array/List Strangeness (why)
by LanX (Saint) on Aug 05, 2009 at 18:29 UTC
    multi-value slices require more complex syntax

    which is really a pity since it breaks the "always dereference with arrow" rule in PBP.

    I don't think I ever saw a good reason given for why it shouldn't be applied, though

    "Mythical" backwards compability? ;-)

    Personally i'd like to have a pragma like strict that bans the "scalar comma operator" ... I have much more trouble than fun with it ... 8(

    Cheers Rolf