in reply to Matching elements in a array

I'm puzzled by the ch(^>*), like everyone else.
Your creation of the hash is a bit laboured, easier to :
my %allowed_tag; @allowed_tag{@tags} = ();
The values are now undef, but that's OK because you are checking with exists.
In general with these kinds of REs you need to define a list of ALL possible patterns (tags) that you need to check for, and proceed from there.