Created
August 3, 2009 13:35
-
-
Save colomon/160555 to your computer and use it in GitHub Desktop.
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 characters
| use v6; | |
| my $in = open "01.pl", :r or die "Unable to open 01.pl: $!\n"; | |
| my $out = open "02.pl", :w or die "Unable to open 02.pl: $!\n"; | |
| for $in.lines | |
| { | |
| when /\#/ { $out.say: $_; } | |
| when /(.*)\"(.*)\"(.*)/ | |
| { | |
| my $start = $0; | |
| my $end = $2; | |
| my $count = 0; | |
| $1.subst(rx/<alpha>/, { $count++ }, :g); | |
| $out.say: $start ~ $count ~ $end; | |
| } | |
| when * { $out.say: $_; } | |
| } | |
| $in.close; | |
| $out.close; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment