foreach my $num (@arr) { print "Index is: $num. Value is: $arr[$num] "; }