tpvinay has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I am newbie here. I am writing a perl script which checks the Virtual Machines status in Linux

How can I embed following shell script into Perl script

sudo virsh --connect xen:///system<<EOF list --all; EOF
Thanks in advance

Replies are listed 'Best First'.
Re: Running a Shell Script Snippet in Perl
by Anonymous Monk on Apr 21, 2010 at 07:18 UTC

    Sorry, I'm not aware of using virtual machine commands. In general, system function will help you.

    To execute a shell script file.

    system("example.sh);

    If you want to execute a multiple line shell script without using any external files, then you could write it as

    system ("bash -c 'ls; date;'");
Re: Running a Shell Script Snippet in Perl
by Anonymous Monk on Apr 21, 2010 at 08:12 UTC

    Seems you want to managed virtual machine, as everything else there's a cpan module for that :P.

    search it here
      Thanks for all the suggestions...I used the system() function, that did the trick.