http://qs321.pair.com?node_id=156524


in reply to Re: Re: Re: Re: Re: Perl vs. Python: Looking at the Code
in thread Perl vs. Python: Looking at the Code

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
(jeffa) 6Re: Perl vs. Python: Looking at the Code
by jeffa (Bishop) on Apr 04, 2002 at 04:41 UTC
    use strict; my $array = new list qw(foo bar); my $list = new list qw(baz qux); $array += $list; print "@$array\n"; package list; use overload "+=" => sub { push @{$_[0]},@{$_[1]};$_[0] }; sub new { my $class = shift; my $self = [@_]; return bless $self, $class; }

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: Re: Re: Re: Re: Re: Re: Perl vs. Python: Looking at the Code
by runrig (Abbot) on Apr 04, 2002 at 04:10 UTC
    array += foo

    I'm sure someday soon you will be able to say in perl:

    @array += @foo; # or even @array += $foo;
    But it won't have anything to do with pushing more elements on to the end of a list...(can anyone say APL?)
    ------------
    ooo  O\O  ooo tilly was here :,(
    
      I belive in Perl 6 it will be @array ^+= @foo;

      -Lee

      "To be civilized is to deny one's nature."