#!/usr/bin/perl use warnings; use strict; use diagnostics; my @a=(6,7,8); my @b=(3,2,1); my @ind = grep { $b[$_]>1 } 0..$#b; @a= map{ $a[$_]}@ind;