in reply to Re^2: Push array into array of arrays
in thread Push array into array of arrays

$VAR1->1 is the array of arrays. but since it has different values, how can i ensure it to be inserted, without overriding the previous ?

Replies are listed 'Best First'.
Re^4: Push array into array of arrays
by poj (Abbot) on Dec 20, 2018 at 07:22 UTC
    how can i ensure it to be inserted, without overriding the previous ?

    Copy @jumpjump to a new anonymous array and insert its reference into @data.

    #!/usr/bin/perl5.14.1 use strict; use warnings; use Data::Dumper; my @tesxt = ('perl','python','pearl', 'pear', 'pink', 'pong'); my @jumpjump = ($tesxt[0], $tesxt[2], $tesxt[3], 'kit','kat',7); my @data = (); push @data, \@tesxt; push @data, [@jumpjump]; splice (@jumpjump); @jumpjump = ($tesxt[0], $tesxt[2], $tesxt[3], 'koo','kaa',7); push @data, [@jumpjump]; print Dumper \@data;
    poj
      omg wow @poj ! thank you very much !! how amazing this anonymous array solved my 2-day-old issue ! amazing square brackets ! thanks ! It works !