my $out=''; for (0..1000) { $out .= "$_"." bottles of beer on the wall\n"; } print $out; #### for (0..1000) { print "$_"," bottles of beer on the wall\n"; } #### package Print; require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(Print); our $sout=''; sub Print { $sout .= "@_"; } END { print $sout; } 1; #### use Print qw (Print); for (0..1000) { Print "$_"," bottles of beer on the wall\n"; }