CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [achen] is this greedy?: Edit Log



savo
User

Sep 30, 2009, 9:19 AM


Views: 2119
Re: [achen] is this greedy?

Your code prints nothing for me so cant just update that but this should help


Code
#!/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)


Edit Log:
Post edited by savo (User) on Sep 30, 2009, 9:21 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives