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: Perl coding standards

2012-02-01 Thread Nemana, Satya
Timothy, Shlomi Fish, Rob, jbiskofski , Thank you for your directions and inputs. I am going through them now. Regards, Satya From: timothy adigun [mailto:2teezp...@gmail.com] Sent: 01 February 2012 05:41 To: Shlomi Fish Cc: Nemana, Satya; beginners@perl.org Subject: Re: Perl coding sta

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 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 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
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 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
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