Skip to content

Instantly share code, notes, and snippets.

@colomon
Created August 3, 2009 13:35
Show Gist options
  • Select an option

  • Save colomon/160556 to your computer and use it in GitHub Desktop.

Select an option

Save colomon/160556 to your computer and use it in GitHub Desktop.
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