qqx
is very nice for running external programs and capturing the results. I'm still in love with using when
in for
loops -- I realize basically the same thing could be done even in Perl 5.8 using if
, but somehow when
just feels right to me. (Oh wait -- the difference is that after when
triggers, it goes to the next iteration of the loop, right? Maybe that's why it seems so nice.)The only real trip-up I had writing this script was once again forgetting that whitespace is ignored in Perl 6 regexs. I had several minutes of panic, thinking that somehow I wasn't getting the correct result from
qqx
, or that something special needed to be done to match against strings with embedded newlines. Then I realized I just needed to add :s
to both regexes. I understand the logic of doing it that way, but I know I will trip up on that more times in the future...
Source code please :-)
ReplyDeletehttp://gist.github.com/166247
ReplyDeleteThat's with the identifying bits stripped out, but it should give the idea...