in reply to Re: Change C style Code into Perl on Windows
in thread Change C style Code into Perl on Windows

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

Replies are listed 'Best First'.
Re^3: Change C style Code into Perl on Windows
by mifflin (Curate) on Jun 10, 2005 at 00:07 UTC
    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% --