You're actually very close.  I would just change a couple of things.

First of all, you don't need @data as well as @rows.  $element is aliased to
each element in the array as it loops, so you can re-assign right back into
the same array when you split.  This will cause the loop to independent of
the order in which it reads the elements from @rows, which means you don't
need '$i' as well.

Second, when you create your nested array, you need to use [].

sub quotes
{
        my $content = get_content();
        my @rows=split/\n/,$content;
        foreach my $element (@rows)
        {
                $element=[split(/,/,$element)];
        }
        return @rows;
}

As a matter of personal style, i prefer to take advantage of the default
variable, since i find it easier to read, though others may not:

sub quotes
{
        my @rows = split /\n/, get_content;
        $_=[split /,/] for @rows;
        return @rows;
}

Or if you want to be COOL like Bob  ;)

        sub quotes {map {[split /,/]} split /\n/, get_content}

And i think in this case using 'map' would be okay, since it's going to have
to loop over the entire array anyway.  Am i wrong ... ?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to