Pretty good, although (and I haven't tested this or anything, so I could be wrong) I believe the last regex could pose a problem at times...
s/(<a href="[^"]+">(\d+)<\/a>)/[$2]/g;
What if the person wrote something like $array[$foo]? Since it only matches when there's a number in the regex, it won't work in this instance. Perhaps something like this:
s/(a href="[^"]+">(\$\w+|\d+)/[$2]/g;
Which would accept all digits or any word preceeded by a $. Of course it still doesn't predict all possibilities, like using a hash value or another array, or taking an array slice, etc. but that particular would tend to crop up pretty commonly I imagine.
All in all, a nice, useful script. Thanks for posting it.
local $_ = "0A72656B636148206C72655020726568746F6E41207473754A"; while(s/..$//) { print chr(hex($&)) }
In reply to RE: Using code posted on PerlMonks
by reptile
in thread Using code posted on PerlMonks
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |