# ouch open(my $fh, '>', 'data.tmp') or die("open failed: $!"); $template->output(print_to => $fh); close($fh); open(my $fh, '<', 'data.tmp') or die("open failed: $!"); chomp( my @template_txt = <$fh> ); close($fh); #### # major ouch open(my $fh, '>', 'data.tmp') or die("open failed: $!"); print $fh $template->output(); close($fh); open(my $fh, '<', 'data.tmp') or die("open failed: $!"); chomp( my @template_txt = <$fh> ); close($fh); #### # one line per array entry, no ouch my @template_txt = split( /\n/, $template->output() ); # all in one scalar, no ouch my $template_txt = $template->output();