in reply to using split on every element in an array

Not sure if this is exactly what you're looking for, but you could try something like this: my @new = map { split /\t/ } split /\n/, $data; Another way to do it is to split on either character: my @new = split /\n|\t/, $data;One of these will probably do what you want.

Note, I haven't tested either one.

Replies are listed 'Best First'.
Re: using split on every element in an array
by tadman (Prior) on Jan 17, 2003 at 16:33 UTC
    I'd think to preserve lines you'd want to use a variation, like:
    my @new = map { [ split(/\t/) ] } split(/\n/, $data);
    This way you end up with an array of arrays, one for each line in the file.