Created
March 19, 2020 21:33
-
-
Save kylebgorman/1b2e5a2d2d5abe12e50c7b5772985460 to your computer and use it in GitHub Desktop.
Revisions
-
kylebgorman created this gist
Mar 19, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/usr/bin/perl use strict; use warnings; use open ":encoding(ascii)"; binmode STDIN, ":encoding(ascii)"; binmode STDOUT, ":encoding(ascii)"; binmode STDERR, ":encoding(ascii)"; while (<>) { $_ = uc; # Case-folds. s/'//g; # Removes /'/ (right quotes and apostrophe). s/[\d\p{PosixPunct}]/ /g; # Replaces digits and punctuation with space. s/\s+/ /g; # Maps whitespace spans to a single / /s. s/^\s+|\s+$//g; # Removes edge whitespace. print "$_\n"; }