in reply to Using PERL to extract XPATH with ":" character

In addition to registering namespace (the answer from stackoverflow ) you can also match using

/TradenetResponse/OutboundMessage/ *[ name ="OutwardPermit" ]/*[ name = "Declaration" ]...

However powerful xml/xpath are, they are just as dumb, maybe even twice that