69 users online (0 members and 69 guests)  


  Results 1 to 5 of 5

Related

  1. Yop Scripts - Free Cool Scripts To Use..    Forum: Internet Services
    Replies: 1
  2. returning value from an onclick event    Forum: Javascript Forum
    Replies: 3
  3. Replies: 1
  4. Replies: 2
  1. #1
    moshleib's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2005
    Posts
    5

    returning values from scripts

    Hi all.
    I need to run a script from another script, and to catch a value the first returns. for example :
    a.pl :
    .
    .
    .
    my $ret_num = 17;
    exit ($ret_num);
    ------------------------------------------
    calling the script from another script:
    my $temp_num = system(a.pl);

    I would like to catch 17 in $temp_num ... but it doesnt work.
    any idea?

    thanks a lot, Moshe.

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Re: returning values from scripts

    Hi, welcome to the forums.

    Haven't checked this, but try checking the $? variable. Thats normally the last exit code.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    moshleib's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2005
    Posts
    5

    Re: returning values from scripts

    Quote Originally Posted by QuietDean
    Hi, welcome to the forums.

    Haven't checked this, but try checking the $? variable. Thats normally the last exit code.
    Thanks for the quick answer ... Have already tried ... it returnd funny numbers ....

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Re: returning values from scripts

    The funny numbers, I suspect, are the proper exit codes. Usually -1 or 0.

    To be honest, I don't think exit codes are meant to be used like this. Wouldn't it be simpler to include the file rather than execute it, and return the number that way?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    moshleib's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2005
    Posts
    5

    Re: returning values from scripts

    Quote Originally Posted by QuietDean
    The funny numbers, I suspect, are the proper exit codes. Usually -1 or 0.

    To be honest, I don't think exit codes are meant to be used like this. Wouldn't it be simpler to include the file rather than execute it, and return the number that way?

    Yeah, I guess this is the only thing I can think about ... a bit ugly but I have no other ideas ...

    Thanks a lot again ... greetings from Israel



Tags for this Thread