At 9:52 PM -0600 11/20/11, Raito Garcia wrote:
Hi everybody
Well I have some problems with my mind, becouse I left programming perl a
couple of years, but right now I need to use it again.
The main problem is how uses hashes with large file to processing it. For
example I have a lot of this lines:
192.168.1.100,tcp,445,SMB,10456,Windows ,CVSS Base Score :
2.6~(CVSS2#AV:N/AC:H/Au:N/C:P/I:N/A:N)
192.168.1.100,tcp,445,SMB,10457,Windows ,CVSS Base Score :
10~(CVSS2#AV:N/AC:H/Au:N/C:P/I:N/A:N)
192.168.1.100,tcp,445,SMB,10458,Windows ,CVSS Base Score :
9.3~(CVSS2#AV:N/AC:H/Au:N/C:P/I:N/A:N)
192.168.1.100,tcp,445,SMB,10459,Windows ,CVSS Base Score :
2.6~(CVSS2#AV:N/AC:H/Au:N/C:P/I:N/A:N)
I know first I split the file, and then use the hashes, I remeber that the
code is very similar to this
%hash=();
open(F,"test.txt") || die "Problems to open the file";
while (<F>){
($IP,$proto,$Sport,$proto2,$Dport,$os,$cvss)=split(/,/,$_);
**********************************
{hash{$port}++}; ---> here is my
problem, I dont remeber how to use the hashes to count all the match of
this field
This statement will increment the count in the hash element having
$port as its key:
$hash{$port}++;
--
Jim Gibson
j...@gibson.org
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/