Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] system command in Perl - Thank You!

Expand Messages
  • aditi gupta
    Wow. Thank you guys for the input! I see the problem now. :) Best Aditi ... From: Jeff Pinyan Subject: Re: [PBML] system command in Perl
    Message 1 of 4 , Oct 25, 2008
    • 0 Attachment
      Wow. Thank you guys for the input! I see the problem now. :)

      Best
      Aditi
      --- On Sat, 25/10/08, Jeff Pinyan <japhy.734@...> wrote:
      From: Jeff Pinyan <japhy.734@...>
      Subject: Re: [PBML] system command in Perl
      To: perl-beginner@yahoogroups.com
      Date: Saturday, 25 October, 2008, 1:52 AM











      On Fri, Oct 24, 2008 at 4:16 PM, aditi gupta <aditi9783@yahoo. co.in> wrote:



      > my $command = "<executable_ name> <argument_list> ";

      > system('$command' ) or die "couldn't execute $command:$!\ n";

      >



      Two problems.



      First: You have *single quotes* around $command, which means it won't be

      expanded as a variable, it will literally be the characters *$command*.

      That's not what you want.



      Second: system() returns a true (non-zero) value when something goes *wrong

      *. It returns false (zero) on success. This is "backwards" and must be

      handled that way:



      system($command) == 0 or die "could not execute $command: $!\n";

      # or

      system($command) and die "could not execute $command: $!\n";



      --

      [Mary said,] "Do whatever he tells you." ~ John 2:5

      The Cross Reference - http://thecrossrefe rence.blogspot. com/

      Nos autem praedicamus Christum crucifixum (1 Cor 1:23)



      [Non-text portions of this message have been removed]



























      Connect with friends all over the world. Get Yahoo! India Messenger at http://in.messenger.yahoo.com/?wm=n/

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.