in reply to system commands/shell and perl variables.

You may be interested in Xen::API. (I have no experience with this - just found it on CPAN.)
use Xen::API; my $x = Xen::API->new; my %vms = $x->list_vms

                As a computer, I find your faith in technology amusing.