in reply to Re: top and STDERR hell...
in thread top and STDERR hell...

Damn, backticks didn't occur to me. (somehow I've gotten in the habit of always using open(H, "app |")). I'll try this out as soon as I get back in the office tomorrow - will let you know.

Thanks!
./ddd

Replies are listed 'Best First'.
Re^3: top and STDERR hell...
by tlm (Prior) on Jun 08, 2005 at 02:48 UTC

    Actually, it's not a backtick thing; that was just the first thing I tried; when I run your code I also get the desired results. Specifically:

    # lll.pl sub longestLineLength { my $longestLen = undef; for my $l ( @_ ) { if ( length($l) > $longestLen ) { $longestLen = length($l); } } return $longestLen; } 1; # propitiatory offering for require __END__ # test03.pl use strict; use warnings; require "lll.pl"; open (TOP, "COLUMNS=1000 /usr/bin/top -bcS -n 1 2>err.txt|") || die "open pipe from top failed $!"; print longestLineLength( <TOP> ) . "\n"; __END__ % perl test03.pl 208

    the lowliest monk

      Hmm, double-checked these and still get the same failing results. I can't explain the disparity between similar-sounding linux (procps) systems.

      Thanks for the data point.
      ./ddd

Re^3: top and STDERR hell...
by DouglasDD (Beadle) on Jun 08, 2005 at 14:12 UTC
    Nope. Same behavior with backticks.
    Darn.