in reply to Performance quandary
Are you sure about this line?
if ( $parent eq "http:/" or $parent eq $key ) {
Is $parent really going to be "http:/" and not "http:" or "http://" (or a complete URL)? Or perhaps do you mean to do something like
if ( $parent =~ /^http:/ or $parent eq $key ) {
The consequence of a false positive on your test is more entries, and thus more runtime.
In Section
Seekers of Perl Wisdom