my ($data_in, $data_out); $data_in = q|<container><a>smile!!! </a><b> smile again!! </b></contai +ner><?query?>|; while ($data_in =~ /<container><a>(.+?)<\/a><b>(.+?)<\/b><\/container> +(<\?query\?>)?/ig) { $data_out = "$2, $1$3 "; #errors here ; #further processing here print $data_out; }
If you put back the second question mark at the end you will get the error:
If you are new to using regular expressions and are on Windows, you can try this free tool: Regex Coach. It will help you see, graphically, how the regex breaks down and will allow you to step through your expression.Use of uninitialized value $3 in concatenation (.) or string at perlmo +nks_700143.pl line 8.
Celebrate Intellectual Diversity
In reply to Re: Special Variables in Regular Expression
by InfiniteSilence
in thread Special Variables in Regular Expression
by fiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |