Fellows
I was trying to capture some different patterns using some large and weird regular expressions, and came across a funny problem. I need to capture a single piece of the code to a variable, but I have a lot of capture-enabled parentesis across the entire regular expression. So I tryied something like this:
my ( $piece ) = $strange_thing =~ m/($large)|$wei($rd)|($stra)$nge/;
I know for sure that when something matches, I will get it on the ${0} - ${\d+} variables, but what is happen is: when things matches with ($large), all goes fine, and $piece contains what I need; but when $strange_thing matches any other pattern, $piece ends with nothing inside. I'm doing something really stupid, I know, but I can't see what. How can I use the same cage to capture many different birds, one at a time?
Thank you all and may the gods bless you all.
"In few words, translating PerlMonks documentation and best articles to other languages is like building a bridge to join other Perl communities into PerlMonks family. This makes the family bigger, the knowledge greather, the parties better and the life easier." -- monsieur_champs
In reply to Many birds, single cage... by monsieur_champs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |