use Switch; use XML::Simple; ... my $xml = XMLin("file"); my $foo = $xml; # the xml is combo print "$foo\n"; # prints the correct value switch ($foo) { case /combo/ { print "found a combo\n"; } }