perl people.... there was a lot of threads to my question ...thank you!  I
will start from the most recent.

 I took and understood the advise of my @a = (); changed to my @a;
Yes I do understand the differing precedence between or and | | .  I have a
habit using | |.  I do also understand that if you use or you should use  (
) as opposed to | | you do not have to use ( ).  Any comments?

Line 15 is changed to, I forgot ti take out the + .     $fa[$i++] =
(split)[-1] if (m/f01(\d+)/gi );
But I do not understand what the (split)[-1] is saying?  please explain.


I reran the code and it seems to be working now.
thanks again, : )
ciao!


#!/usr/bin/perl
1> use strict;
2> use warnings;
3> $ENV{"PATH"} =
qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);
4> open (V4, "samcmd v4 2>\&1 |" ) || die "unable to open pipe... Broken?
$!";
5> my @fa =();
6> my @ha =();
7> my $i =0;
8>        foreach (<V4>) {
9>               local $, = "\n";
10>              #print +(split)[6,7], $,;
11>              s <sg> ();
12>              s {\-*} ()g;
13>                s {\w+} ()i;
14>                print +(split)[5,6,7], if (m/f01(\d+)/gi )
15>               #$fa[$i++] = +(split)[5,6,7] if (m/f01(\d+)/gi );
16>               #print +(split)[4],$,; #% column
17>      }
18> close (V4);
19> print "\n";
20> print "Now printing array element 0\t", $fa[0], "\n";
21> #print "Now printing entire array \t", @fa, "\n";
22> print "Now printing array count \t", $#fa, "\n";



Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145



                                                                           
             "JupiterHost.Net"                                             
             <[EMAIL PROTECTED]                                             
             st.net>                                                    To 
                                       beginners@perl.org                  
             04/27/2005 12:03                                           cc 
             PM                                                            
                                                                   Subject 
                                       Re: REGEXP removing - il- - -b-f    
                                       and - il- - - - f                   
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




> I was assuming it was a typo/email munge, and that the command he
> pipes actually produces consistent output.  That may be a faulty
> assumption on my part.  YOu know what they say about assumptions In

Its hard to say Derek doesn't give us much to work with :)

> general, though, when parsing log files (which seems to be waht's
> going on here) if you're assured reasonably consisten data, it's
> better IMNSHO to look for a particular index, because loggers are more
> likely to add occasional extranious info or comments at the end of the
> line than in the middle.

Yeah, I imagine you're correct in your assumption, without actual valid
info its hard to tell :)

Basically if you're gauranteed it index 7 use index 7, otherwise if
you're gauranteed its the last item (and it may be 7 and it may not be(
use the $#array version, if you can't do either redo it all based on
hoew the output is. And if you post to the list about it please send
accurate info.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to