my @arr =(10,11,12); my $count =1; foreach my $x (@arr) { print $count++," $x\n"; } #prints #1 10 #2 11 #3 12