in reply to Re: When the only tool you have is a screwdriver...
in thread When the only tool you have is a screwdriver...
Cleaning up (and making more clear) the parsing.
#!/usr/bin/perl # http://perlmonks.org/?node_id=1144184 use strict; use warnings; sub e { /\Gua/gc ? return e() : /\Gu/gc || return 0; 1 while (/\Gd/gc && e() && /\Gf/gc or /\Gb/gc) && e() or /\Gc/gc; return 1; } for (qw( u udufu uau uu uc ubu ucbuc uaau ua uauau uccc uauuau )) { print e() && /\G\z/ ? "matches" : " fail", " $_\n"; }
Again, do you have a good set of test cases ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: When the only tool you have is a screwdriver...
by Anonymous Monk on Oct 09, 2015 at 02:29 UTC | |
by Anonymous Monk on Oct 09, 2015 at 02:33 UTC |