John Sampson wrote:
I am trying to accumulate items in a flat list (array) by concatenating on to it the scalars contained in arrays which in turn are contained in arrays.

Is this what you are talking about?

    my @arr1 = ( [ 1, 2 ], [ 3, 4 ] );
    my @arr2 = ( [ 5, 6 ], [ 7, 8 ] );
    my @newarray;
    foreach ( @arr1, @arr2 ) {
        push @newarray, @$_;
    }
    print "@newarray\n";

If not, please translate the above into Perl by posting your best code attempt.

The data is to be read in from a file rather than existing as literals in my code.

From a file? In that case, why bother with the arrays of arrays?

Everything I try either crashes the computer or gives me an array of arrays instead of a flat list.

Let's see it. And please include sample data.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to