
savo
User
Sep 30, 2009, 9:19 AM
Views: 1739
|
|
Re: [achen] is this greedy?
|
|
|
Your code prints nothing for me so cant just update that but this should help
#!/usr/bin/perl use warnings; use strict; use 5.010; my $rd7_activeconnhighcount; my $fgrlog_activeconnhighcount; open (LOG, "<test.log") or die "can't open log file: $!\n"; my $c = 1; while (<LOG>) { chomp; if ($c == 1) { $rd7_activeconnhighcount = $1 if /(ActiveConnectionsHighCount?)/ } else { $fgrlog_activeconnhighcount = $1 if /(ActiveConnectionsHighCount?)/ } if (/JDBC Runtimes fgrlog/) { ++$c} } say $rd7_activeconnhighcount; say $fgrlog_activeconnhighcount; It will print ActiveConnectionsHighCount ActiveConnectionsHighCount I have to go now so cant finish it. If you work it out let me know how if not i will try looking again later or tomorrow. I am new to perl but could a hash be used here rather than all the variables?
(This post was edited by savo on Sep 30, 2009, 9:21 AM)
|