Help for this page

Select Code to Download


  1. or download this
    use autodie;
    my $filename = <STDIN>;
    chomp $filename;     # remove trailing newline character
    open my $handle, '>', $filename;
    #                 ^  if you want to write to that file
    
  2. or download this
    use autodie;
    open my $handle, '<', 'yourfile.txt';
    ...
         chomp $line;  # remove trailing newline
         # do something with $line here.
    }