Skip to content

Instantly share code, notes, and snippets.

@stevieb9
Created May 30, 2016 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevieb9/9d0c50c118a14b28de2b0ae6ca0b051f to your computer and use it in GitHub Desktop.
Save stevieb9/9d0c50c118a14b28de2b0ae6ca0b051f to your computer and use it in GitHub Desktop.
Perl6: Capture windows newline with regex
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