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