foreach my $num (@arr) { print "Index is: $num. Value is: $arr[$num - 1] "; # Subtract 1 from the index }