Help for this page

Select Code to Download


  1. or download this
    # ouch
    open(my $fh, '>', 'data.tmp') or die("open failed: $!");
    ...
    open(my $fh, '<', 'data.tmp') or die("open failed: $!");
    chomp( my @template_txt = <$fh> );
    close($fh);
    
  2. or download this
    # major ouch
    open(my $fh, '>', 'data.tmp') or die("open failed: $!");
    ...
    open(my $fh, '<', 'data.tmp') or die("open failed: $!");
    chomp( my @template_txt = <$fh> );
    close($fh);
    
  3. or download this
    # 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();