in reply to split and sysread()
Are your records terminated with newlines or are they fixed length? Your call to sysread looks very wrong. If the records are terminated by newlines, use <INFILE> to read a record. If they are fixed length, the third argument to sysread should be the record length and you shouldn't use the fourth argument.
This might make the first part work. Extending it to the second part is up to you.
while ($buffer = <INFILE>) { chomp $buffer; my ($server,$ip,$api,$calls) = (split('|',$buffer))[0,9,3,4]; $totalsentrycalls++; $count_by_sentry_server{$server}++; $count_by_ip{$ip}++; $count_by_api{$api}++; $count_by_api_exec{$api}{$totalsentrycalls}=$calls; .... }
| 90% of every Perl application is already written. ⇒ |
| dragonchild |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: split and sysread()
by relaxed137 (Acolyte) on Apr 18, 2003 at 23:58 UTC | |
by Limbic~Region (Chancellor) on Apr 19, 2003 at 00:19 UTC | |
by relaxed137 (Acolyte) on Apr 19, 2003 at 00:32 UTC | |
by runrig (Abbot) on Apr 19, 2003 at 18:25 UTC | |
by dws (Chancellor) on Apr 18, 2003 at 23:59 UTC | |
by pfaut (Priest) on Apr 19, 2003 at 00:12 UTC |