in reply to Handling long command lines (was: Input to external program)

You can call magic open

open THING, '|-', '/path/to/util.exe', @clargs; print THING for <DATA>; # or some such

Update: Reply, Have you tried an absolute path to util.exe, as indicated? Can't guarantee anything about w32, but the full path to the executable would help on 'nix. That construction leaves out the shell, which would prevents relative paths from being resolved without luck.

After Compline,
Zaxo

Replies are listed 'Best First'.
Win32: best way to Input to external program
by smackdab (Pilgrim) on May 11, 2002 at 01:52 UTC
    Thanks for the help...I couldn't get it to work ;-(
    (As a reminder, I am on Win32...)

    open (THING, '|-', 'sort.exe'); my @unsorted = qw(bbb aaa ccc eee ddd); print THING "$_ " foreach @unsorted; close (THING); # My assumption is that after I close(), sort.exe knows to start "sort +ing"...
    outputs:
    bbb aaa ccc eee ddd
      I know that the unix "sort" work on lines so perhaps you might need to replace :
      print THING "$_ " foreach @unsorted;
      by
      print THING "$_\n" foreach @unsorted;

      ???

      "sort" reads all the lines and sort them in memory (and using temporary files), then when it receive an EOF on STDIN (your close()) it print out the sorted lines.

        aahh, this is why I like asking questions here...ya always learn something new ;-)