use strict; use warnings; my $i; sub my_print { print $i; }; foreach (0, 1) { $i = $_; my_print(); # 0,1 }