in reply to Re^2: How can increase number sequence in a variable
in thread How can increase number sequence in a variable

Hi kgb, I'm not certain what you are intending to show there.

As I understood it the OP wanted to keep the arrays separated in the loop. And if they are to be contatenated with join, you don't need map.

perl -Mstrict -E 'my @x=(1..2); my @y=(3..4); say join "->", (@x,@y)' 1->2->3->4


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^4: How can increase number sequence in a variable
by karlgoethebier (Abbot) on Nov 18, 2017 at 10:37 UTC
    "...what you are intending to show..."

    Good question. Perhaps the Roussillon i had last night wasn't so inspiring as i hoped.

    Presumably i meant something like this:

    #!/usr/bin/env perl use strict; use warnings; use Data::Dump; my @x = ( 1 .. 2 ); my @y = ( 3 .. 4 ); dd \@x; dd \@y; my @result = map { $_ } ( @x, @y ); dd \@result; dd \@x; dd \@y; __END__ karls-mac-mini:monks karl$ ./1nickt.pl [1, 2] [3, 4] [1 .. 4] [1, 2] [3, 4]

    The source arrays are intact and no need to deref here.

    If this is helpful to the OP or good is another question ;-)

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help