roboticus and toolic are right that you should be using a real parser for such relatively complex input. Why try to re-implement a parser when it's already been done for you by someone else? :-)
Just for completeness, how to fix your script: 1. You use local $/ = "";, which will cause the entire file to be slurped on the first iteration of the while loop, and then you only call your regex once. If you want to match once per line, remove the local $/ = "";, otherwise, you could use something like push @fields, $1 while /$reM/g; to match as many times as possible in the current string. Also, I'd change .* to being non-greedy, i.e. .*?. 2. Your regex requires a space after the opening {, but your input does not have a space there, so it will not match. I'd suggest something like \s* to match any amount of whitespace, even none.
In reply to Re: how to extract multiple pattern into array
by Anonymous Monk
in thread how to extract multiple pattern into array
by herman4016
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |