Re: Parsing Question

2012-02-02 Thread Brandon Phelps
Thanks everyone for the great ideas. After I implemented the solution(s) you guys proposed I stumbled upon Nagios::Object (http://search.cpan.org/~duncs/Nagios-Object-0.21.16/). I did learn a few things from your ideas though so I am grateful none the less! I recommend anyone working with Na

Re: Parsing Question

2012-02-02 Thread Rob Dixon
On 31/01/2012 22:43, Brandon Phelps wrote: Hello all, I am attempting to parse a Nagios status.dat file and am curious about what the most efficient way to do this would be. I'm sure I could come up with something but it would be very convoluted and I'm sure there is a better way. Below is a sam

RE: Parsing Question

2012-02-02 Thread Kronheim, David (Contr)
February 01, 2012 2:11 PM To: jbiskofski Cc: Brandon Phelps; beginners@perl.org Subject: Re: Parsing Question Hi jbiskofski, This script will not work WHY? -- Scalar found where operator expected at . [ Please Check ] line 72, near "$we_are_inside_hoststatus_block" .. This commun

Re: Parsing Question

2012-02-01 Thread jbiskofski
ah - i get it now. thanks. On Wed, Feb 1, 2012 at 3:05 PM, Jim Gibson wrote: > On 2/1/12 Wed Feb 1, 2012 11:24 AM, "jbiskofski" > scribbled: > > > Your comment about the open statement is OK. I guess it really comes down > > to style. I was trying to write something clear that Brandon could

Re: Parsing Question

2012-02-01 Thread Jim Gibson
On 2/1/12 Wed Feb 1, 2012 11:24 AM, "jbiskofski" scribbled: > Your comment about the open statement is OK. I guess it really comes down > to style. I was trying to write something clear that Brandon could improve > upon. It is not simply a matter of style. Because of operator precedence, the s

Re: Parsing Question

2012-02-01 Thread jbiskofski
Timothy Could it be that when you copy pasted the script the line wrap got messed up? It works fine for me. Im using perl 5.12.3 Your comment about the open statement is OK. I guess it really comes down to style. I was trying to write something clear that Brandon could improve upon. Here is a p

Re: Parsing Question

2012-02-01 Thread timothy adigun
Hi jbiskofski, This script will not work WHY? -- Scalar found where operator expected at . [ Please Check ] line 72, near "$we_are_inside_hoststatus_block" .. On Wed, Feb 1, 2012 at 6:38 PM, jbiskofski wrote: > Hey Brandon > > Here is a solution to this problem. It is purposely r

Re: Parsing Question

2012-02-01 Thread jbiskofski
Hey Brandon Here is a solution to this problem. It is purposely really long. It takes the simplest most understandable solution. If you have questions about it let me know. #!/usr/local/bin/perl # always a good idea, forces scope to if/for/foreach/while blocks use strict; # open the file, int

Re: Parsing Question

2012-02-01 Thread Igor Dovgiy
Just my $0.02... can't help offering a slight rewrite of David's great program. Now it's runnable on 5.010 and earlier, and should give out some warnings if hoststatus sections are somehow corrupt: $|++; # comment it out if you don't need to buffer the output my $section_started; my ($host, $state

RE: Parsing Question

2012-02-01 Thread Kronheim, David (Contr)
Brandon, I took most of your comments and sample data and put it in the following program. Taking the data out of the program and parsing it from files and directories, might be a good exercise for you. Generally variables are best declared close to where they are first used. Since the scope of

Re: Parsing Question

2012-01-31 Thread Brandon Phelps
Thanks a ton David, This will definitely help! Not able to try it now but I'll give it a shot first thing tomorrow. -Brandon On 1/31/2012 8:15 PM, Kronheim, David (Contr) wrote: Brandon, I took most of your comments and sample data and put it in the following program. Taking the data out

RE: Parsing question

2001-10-19 Thread Bob Showalter
> -Original Message- > From: Anderson, Carlin [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 19, 2001 2:53 PM > To: '[EMAIL PROTECTED]' > Subject: Parsing question > > > We are integrating with the Yahoo storefront for some > customers, and I am > having a problem accessing some of