in reply to Pattern Match
#!/usr/bin/perl # http://perlmonks.org/?node_id=1192327 use strict; use warnings; print /^Fruit(?:\{|s\{(?: \w+)+) \w+ \}$/ ? 'Pass ' : 'Fail ', $_ while <DATA>; __DATA__ Fruits{ Apple Mango Grape Watermelon } Fruit{ Apple } Fruits{ Lemon Mandarin }{ Orange Fig Pineapple } Vegetable{ Carrot } who knows{ what } you expect here
|
|---|