People of the Perl,
I have tried this code with no errors, but it is not giving
me any results. My data file has 3 fileds and I am trying to sort the 3rd field, here is the data file:
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
Below is my code:
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);
My out file is zero bytes! Help!
thanks
drock
janitored by ybiC: Balanced <code> tags around sample data, as per consideration
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.