drock has asked for the wisdom of the Perl Monks concerning the following question:
Below is my code:05/06/04 11:01:32 E00833 05/06/04 11:01:32 E00545 05/06/04 11:01:32 E00820 05/06/04 11:01:32 E00610 05/06/04 11:01:32 E00333 05/06/04 11:01:32 E01099 05/06/04 11:01:32 E00213 05/06/04 11:01:32 E00612
My out file is zero bytes! Help!snippett...snippett open (FOO, ">$scratches") || die "could not open file:$!"; open (D, "$logf") || die "could not open file:$!"; while (<D>) { ## look for 9840S and ebexpire ## declare OFS = tab ## tell split to split on IRS 0, + 1 & 5. Very similar to awk print $ if (($_ =~ /9840S/) && ($_ =~ /ebexpire, ebexpire/ )) +{ local $, = "\t"; print +(split)[0,1,5], $/; } # end if } # end while foreach (<D>) { print FOO (sort { $a <=> $b } $_ ) } close (FOO); close (D);
janitored by ybiC: Balanced <code> tags around sample data, as per consideration
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sort using <=>
by Happy-the-monk (Canon) on Aug 13, 2004 at 18:29 UTC | |
by drock (Beadle) on Aug 13, 2004 at 18:57 UTC | |
by Roy Johnson (Monsignor) on Aug 13, 2004 at 20:22 UTC | |
|
Re: sort using <=>
by VSarkiss (Monsignor) on Aug 13, 2004 at 18:35 UTC | |
|
Re: sort using <=>
by Plankton (Vicar) on Aug 13, 2004 at 18:13 UTC |