foreach (@myArray) {
print qq~$_ is in the $nth position in this array~;
}
replacing $nth with the position number.
@myArray = ("apple","banana","carrot");
foreach (@myArray) {
print qq~$_ is in the $nth position in this array\n~;
}
would print:
apple is in the 0 position in ths array
banana is in the 1 position in this array
carrot is in the 2 position int this array