my $xml_text = do { local(@ARGV, $/) = 'myfile.xml'; <> };
But actually using the content is a different matter. XML is pretty complex to parse, which is why people generally use a pre-written XML module. Parsing a limited subset of XML is generally doable using regular expressions, but I'd still consider this a last resort.
Any particular reason why you're not using modules? See Top Seven (Bad) Reasons Not To Use Modules.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
|