I'm having trouble doing a match for this xml string in perl.
<?xml version="1.0" encoding="UTF-8"?><HttpRemoteException path="/proj/feed/abc" class="java.io.FileNotFoundException" message="/proj/feed/abc: No such file or directory."/>
I want to place a condition on FileNotFoundException like so:
code snippet:
my @lines = qx(@cmdargs);
foreach my $line (@lines) { print "$line"; }
if (my $line =~ m/(FileNotFoundException)/) {
print "We have an ERROR: $line\n";
}
Error:
Use of uninitialized value in pattern match (m//) at ./tst.pl
myas well and usinguse strictanduse warningsuse strict; use warnings; my $line = '<?xml version="1.0" encoding="UTF-8"?><HttpRemoteException path="/proj/feed/abc" class="java.io.FileNotFoundException" message="/proj/feed/abc: No such file or directory."/>'; if ($line =~ m/(FileNotFoundException)/) { print "We have an ERROR: $line\n"; }XML::LibXML.