Is it the case that dd-wrt doesn't do UPnP and you wish to add it with perl? or you wish to access the UPnP that dd-wrt has from XP? Either way, I'd be somewhat surprised if it wasn't built into both.
From the dd-wrt docs it appears that UPnP is built in. Im trying to figure out the logistics of getting from a perl script out through the XP firewall and then out through the router. For some reason I think this is do-able. It may be folly though.
Here's a bit from the dd-wrt docs: http://www.dd-wrt.com/wiki/index.php/Port_Forwarding