in reply to Re: Concatenating more than one variable in perl
in thread Concatenating more than one variable in perl

Teach me to number not the vars of my scripts, but the indices of my arrays...

  • Comment on Re^2: Concatenating more than one variable in perl

Replies are listed 'Best First'.
Re^3: Concatenating more than one variable in perl
by LanX (Saint) on Jun 19, 2014 at 22:41 UTC
    > Teach me to number not the vars of my scripts, but the indices of my arrays...

    well, if you beg me so nicely... ;-)

    DB<100> use List::MoreUtils "pairwise" DB<101> @vars=qw(X Y) => ("X", "Y") DB<102> @appends=qw(x y) => ("x", "y") DB<103> pairwise { $a .= $b } @vars, @appends => ("Xx", "Yy") DB<104> @vars => ("Xx", "Yy")

    and for completeness

    DB<105> @vars=qw(X Y) => ("X", "Y") DB<106> @vars = pairwise { $a . $b } @vars, @appends => ("Xx", "Yy")

    Cheers Rolf

    (addicted to the Perl Programming Language)