use XML::Simple; my $content = do { local (*ARGV, $/); @ARGV = "mylogfile"; <> }; my $parsed_logfile = XMLin("$content", \%other_options);