$value = "four"; my @array = ( "one", "two", "three" ); foreach $value (@array) { print "foreach value: $value\t"; function(); } sub function { print "function value: $value\n"; } __END__ foreach value: one function value: one foreach value: two function value: two foreach value: three function value: three