in reply to A (non) reg-ex question

Another way would be to use Parse::RecDescent.
#!/usr/bin/perl -w use strict; use Parse::RecDescent; my $parser = new Parse::RecDescent (q{ L: '0' L '1' L: '' }); my $string1 = "00111"; my $string2 = "0011"; print $parser->L(\$string1) && $string1 eq '' ? "" : "not ", "in L\n"; + # not in L print $parser->L(\$string2) && $string2 eq '' ? "" : "not ", "in L\n"; + # in L
I am a Parse::RecDescent newbie. Does someone know to write the evaluation in a better way?