troubleshooting Question

Perl and XML

Avatar of Simon336697
Simon336697Flag for Australia asked on
Perl
4 Comments1 Solution354 ViewsLast Modified:
Guys very newbie question here.

If Im using perl eg.to do various system admin tasks, let's say the following...

-------------------------------------------------- script.pl

#!/usr/bin/perl -w
use strict;
use warnings;

open(SUCCESS, ">successpcs.txt") or die "Can not create success: $!\n";
open(FAILED, ">failedpcs.txt") or die "Can not create failure: $!\n";

open(LIST,"<systems.txt") or die "Can not open list: $!\n";
while (my $server=<LIST>) {
      system("net use s: \\$server\ipc\$");
      if(!-e 's:\status.txt') {
            print "$server doesn't have a status.txt file\n";
            next;
      }
      unless(open(IN,'s:/status.txt')){
            print "Could not open status.txt on $server\n";
            next;
      }
      local $/;
      my $data=<IN>;
      my $found=0;
      if($data =~ /success/) {
            print SUCCESS "$server\n";
            $found=1;
      }
      if($data =~ /failed/) {
            print FAILED "$server\n";
            $found=1;
      }
      next if $found;
      print "$server is not success or failed\n";
}

close(LIST);
close(SUCCESS);
close(FAILED);

----------------------------------------------------------------

How would you convert the output into xml format?

Any help greatly appreciated.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros