in reply to regex help

Questions:

Replies are listed 'Best First'.
Re^2: regex help
by Anonymous Monk on Apr 21, 2012 at 20:52 UTC
    no criteria, just missed it out by accident. all i need to do is extract variable,array names. variables like $array1 should just be $array. i guess i will need to avoid ${__PACKAGE__
      Perhaps then all what you need is (untested):
      /(?(DEFINE) (?<sigil> [\$\@%&*]) (?<name_atom> (?: [_A-Za-z][_A-Za-z0-9]* | [0-9]+) ) (?<separator> (?: :: | ')) (?<name> (?: (?&separator)? (?&name_atom) (?:(?&separator) (?&name_atom))*)) (?<punct> \S)) (?&sigil) \s* (?:(?&name) | (?&punct)) /x
        Unless there is use utf8; somewhere... :-)