in reply to Change C style Code into Perl on Windows

It looks like you want to continually do a netstat and grep out only the lines that have the string '6000' in them.
I tried the following on my PC and on my unix box and it works on both (although I had to search for another number).
while (1) { print for (grep {/6000/} `netstat -n`); sleep 5; }

Replies are listed 'Best First'.
Re^2: Change C style Code into Perl on Windows
by Fletch (Bishop) on Jun 09, 2005 at 23:48 UTC

    Minor efficiency nit, but grep /6000/, `netstat -n` would be better as it avoids a BLOCK enter/leave for each line. If your grep test is a single EXPR rather than multiple statements it can shave a little time off. (And of course Benchmark to verify for your particular case if you're in doubt).

    --
    We're looking for people in ATL

      yep!
      erickn@cosmora01d:/home/erickn> cat xx use Benchmark qw(:all); cmpthese ( 10000000, {mifflin => &mifflin, fletch => &fletch } ); sub mifflin { grep {/6000/} qw(1 2 3 4 5 6000 7 8 9 10); } sub fletch { grep /6000/, qw(1 2 3 4 5 6000 7 8 9 10); } erickn@cosmora01d:/home/erickn> perl xx Rate mifflin fletch mifflin 5128205/s -- -19% fletch 6329114/s 23% --