Created
May 30, 2016 22:48
-
-
Save stevieb9/9d0c50c118a14b28de2b0ae6ca0b051f to your computer and use it in GitHub Desktop.
Perl6: Capture windows newline with regex
This file contains 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 characters
use v6; | |
use experimental :pack; | |
my $fn = 'in.txt'; | |
my $fh = open $fn, chomp => False; # I've also tried :bin | |
for $fh.lines -> $line { | |
if $line ~~ /(<[\r\n]>**1..2)/ { | |
$0.Str.encode('UTF-8').unpack("H*").say; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment