http://www.perlmonks.org?node_id=338191


in reply to Regex question

What I would do is set the default value first, then try the match. Something like this:

$match = "chiapet"; # default value if ($string =~ /foobar(...)/) { # probably want to capture something +here $match = $1; }

Or the ternary ?: operator, like this:

$match = ($string =~ /foobar(...)/) ? $1 : "chiapet";

-- Mike

--
XML::Simpler does not require XML::Parser or a SAX parser. It does require File::Slurp.
-- grantm, perldoc XML::Simpler