in reply to Re: running status
in thread running status

i think you missunderstand. i can use the system command and info is outputted to the screen ok but what i am trying to do is have the ability to look at avariable and see, for example when a file is 50% done then do something if it is like pop up a perl/tk message saying "50% done" or something. so you don't have to look at the dos box.

Replies are listed 'Best First'.
Re: Re: Re: running status
by metadoktor (Hermit) on Jan 13, 2002 at 00:24 UTC
    Ok, I see your point. You want to read the output as it's happening?

    Unfortunately, it seems like the ActiveState version of Perl does not accept file redirection. You could download and install Cygwin along with it's distribution of perl. Then you would be able to run the following script which would probably do what you want.

    # Execute program and put it in the background. system("program > out.txt &"); # Wait for file to be created otherwise this will fail. sleep 3; open(IFILE,"<out.txt") or die "Couldn't open file. $!\n"; # Keep reading until nothing more to read. while (<IFILE>) { # Do something with output. print "$_\n"; } close(IFILE);

    metadoktor

    "The doktor is in."