Declare variable in foreach statement
#!/usr/bin/perl -w use strict; my @array = (1, 3, 5, 7, 9); foreach my $i (@array) { print "This element: $i\n"; }