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

"...pass a reference"

It depends...

perl -Mstrict -E 'my @x=(1..2); my @y=(3..4); say join ",", map{$_} (@x,@y)'

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

Replies are listed 'Best First'.
Re^3: How can increase number sequence in a variable
by 1nickt (Canon) on Nov 17, 2017 at 21:30 UTC

    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.
      "...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