in reply to split and assign

What about if I need 3 of the elements, not just one? Right now I'm using:
$line = "aa;bb;cc;dd;ee"; my @stuff = split(/;/, $line); my $a = $stuff[0]; my $b = $stuff[1]; my $d = $stuff[3];
Is there a shortcut to this?
I'm actually parsing a csv and only need columns 1, 2 and 8... Thanks!

Replies are listed 'Best First'.
Re^2: split and assign
by hazylife (Monk) on Mar 04, 2014 at 18:54 UTC
    I'm actually parsing a csv and only need columns 1, 2 and 8
    my ($a, $b, $c) = (split /;/, $line)[0,1,7];
      Thanks! My brain is fried, I kept trying multiple [] like [0][1][7] and [0],[1],[7]...