olecs has asked for the wisdom of the Perl Monks concerning the following question:
open EXT,"|extprog"; while (<>){ @data = conv_data($_); print EXT "$data[0] $data[1]\n"; } close EXT;
$run = "mapproject -F --D_FORMAT=\%lf -I --ELLIPSOID=HELMERT1906 -Jt31/30/1: +1 -R31/40/30/39 --MAP_SCALE_FACTOR=1.0000 "; open FH, "<depths.asc.to" or die "could not open asc file\n"; if ( $pid = open RESULTS, "-|" ) { # I am the original process, so read from <RESULTS> below } else { # I am the kid if ( $pid1 = open STDIN, "-|" ) { # I am still the kid, but my STDIN is now piped from the grand +kid exec "$run"; } else { # I am the grandkid: be a data pump while (<FH>) { print "$_\n"; } exit 0; } } while (<RESULTS>) { print $_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: output from an external program
by Zaxo (Archbishop) on Dec 01, 2005 at 13:48 UTC | |
by olecs (Scribe) on Dec 01, 2005 at 14:00 UTC | |
by merlyn (Sage) on Dec 01, 2005 at 14:44 UTC | |
|
Re: output from an external program
by davorg (Chancellor) on Dec 01, 2005 at 13:48 UTC | |
|
Re: output from an external program
by psychotic (Beadle) on Dec 01, 2005 at 16:17 UTC | |
|
Re: output from an external program
by neilwatson (Priest) on Dec 01, 2005 at 13:40 UTC | |
by olecs (Scribe) on Dec 01, 2005 at 13:47 UTC | |
|
Re: output from an external program
by tphyahoo (Vicar) on Dec 07, 2005 at 14:01 UTC | |
by olecs (Scribe) on Dec 08, 2005 at 09:43 UTC |