in reply to why doesn't my array get extended?

By doing push @rrdgraph2, @rrdgraph0 you make the graph0 array as a whole an element of the graph2 array. You do not assign the values of the graph0 array to the graph2 array.
To do such could do:
foreach (@rrdgraph0) { push @rrdgraph2, $_; }

Now you push every element from graph0 to graph2
(I think this is what you meant...)

Sinister greetings.

Replies are listed 'Best First'.
Re: Re: why doesn't my array get extended?
by davorg (Chancellor) on May 04, 2001 at 12:22 UTC

    Er... this seems to contradict what perldoc -f push has to say on the subject...

    push ARRAY,LIST Treats ARRAY as a stack, and pushes the values of LIST onto the end of ARRAY. The length of ARRAY increases by the length of LIST. Has the same effect as for $value (LIST) { $ARRAY[++$#ARRAY] = $value; } but is more efficient. Returns the new number of elements in the array.
    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

Re: Re: why doesn't my array get extended?
by hdp (Beadle) on May 05, 2001 at 21:11 UTC
    That turns out not to be the case. To "make the graph0 array as a whole an element of the graph2 array", one would use something like push @rrdgraph2, \@rrdgraph0. push @rrdgraph2, @rrdgraph0 does the same thing as your foreach loop, but is more efficient.

    I suggest reading perldsc at least so that you understand why your solution is incorrect.

    hdp.