Syntactic Confectionery Delight | |
PerlMonks |
Re: Extract a string from the lineby hippo (Bishop) |
on May 29, 2021 at 11:20 UTC ( [id://11133263]=note: print w/replies, xml ) | Need Help?? |
Where is the mistake in the code ? In addition to the incorrect regex you have a scoping problem with your $a. This is hidden from you because of your choice of variable name. Never use $a or $b as a general variable name in perl - they are special variables used for sort routines. If you replace your $a with $num for example then your code won't compile:
See Coping with scoping for why this is. FWIW, I'm happy to add my voice to those suggesting that an XML parser is almost certainly a better approach for this task. 🦛
In Section
Seekers of Perl Wisdom
|
|