OK!
But now I have a new problem, I think that may work, but there is a timestamp in each line, so I need so split before you process the line in the file. The split needs to be a regular expression split, of ':
01-60 ' so that is will be split with ':' and any number 01 - 60 followed by a space, together:
':34 ' or ':21 ' or ':57 ' would all work, this is the seconds in the timestamp of course. that should leave us with an array with [0] (the trash) and
1 (the goodies)
I tried inserting somehting like:
# create variables:
# $pattern - pattern for regular expression
# %parsed - hash, keys are lines containing pattern,
# values are counter of times seen
# $i - counter of total lines matching pattern
my $pattern = 'fwa';
my (%parsed, $i);
while(<$FILE>){
# read line from filehandle, assign to special variable $_
if(/$pattern/i && $i++)
{
chomp $_; # remove newline
@new=split(/:[01-60] /,$_);
$_=$new[1];
$parsed{ $_ }++; # use line as hash
ect ect ect.......
But that didn't work, and I am unsure of both the regex, and ties with your code. Any more help would be much appriciated.
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.