From: "LI NGOK LAM" <[EMAIL PROTECTED]>
> I've tried to use exec, system, and ``. And also with and without $| =
> 1; but seems unable to do what I want.

If everything else fails, try to read the manual :-)

perldoc -f exec
  exec LIST
  exec PROGRAM LIST
    The "exec" function executes a system command *and never
    returns*-- use "system" instead of "exec" if you want it to
    return. It fails and returns false only if the command does not
    exist *and* it is executed directly instead of via your system's
    command shell (see below).
        ...

So exec() is definitely not what you are after.

You want
        system( 1, "notepad");

perldoc perlport
        system(1, @args)
        spawns an external process and immediately returns its process
        designator, without waiting for it to terminate.  Return value may
        be used subsequently in C<wait> or C<waitpid>.  Failure to spawn() 
        a subprocess is indicated by setting $? to "255 << 8".  C<$?> is set
        in a way compatible with Unix (i.e. the exitstatus of the subprocess
        is obtained by "$? >> 8", as described in the documentation).  

Actually this is something that should be documented better. It may 
seem that the system( 1, ...) only works on Win32 which is not true.

Anyway ... another option would be to use Win32::Process module.

HTH, Jenda

===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to