$ cat unexpected.pl #!env perl use strict; use warnings; my $S4; sub X { print "<$S4>\n"; return $S4; } for $S4 (1 .. 2) { print "A: <$S4> <", X(), ">\n"; } $ perl unexpected.pl Use of uninitialized value $S4 in concatenation (.) or string at unexpected.pl line 8. <> Use of uninitialized value in print at unexpected.pl line 13. A: <1> <> Use of uninitialized value $S4 in concatenation (.) or string at unexpected.pl line 8. <> Use of uninitialized value in print at unexpected.pl line 13. A: <2> <> #### $ perl --version This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-cygwin-threads-multi (with 7 registered patches, see perl -V for more detail) Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.