Help for this page

Select Code to Download


  1. or download this
    open my $handle, '<', $path_to_file or die "Not able to open file: $!"
    +;
    chomp(my @lines = <$handle>);
    close $handle or warn "Not able to close file: $!";
    
  2. or download this
    open my $fh, '>', "output.txt" or die "Cannot open output.txt: $!";
    
    ...
        print $fh "$_\n";
    }
    close $fh or warn "Not able to close output.txt: $!";
    
  3. or download this
    print $fh join ("\n", @lines);