my @data = (Some existing values); my @column = ; for my $index(@columns){ .. use $data[$index] }