Help for this page

Select Code to Download


  1. or download this
    # read
    use Path::Tiny;
    my @words = ( path($filename)->slurp ) =~ /^.+$/gm;
    
  2. or download this
    # optional read without Path::Tiny
    my @words = do { local(@ARGV, $/) = $filename; <> =~ /^.+$/gm };
    ...
    # or
    my @words = do { local(@ARGV, $/) = $filename; split /\n/, <> };
    
  3. or download this
    # write
    use Path::Tiny;
    use List::Util qw( uniq );
    path($filename)->spew(join "\n", uniq(@words), '');