Bill-

[EMAIL PROTECTED] wrote on 07/20/2006 07:06:53 PM:

> hi josh -- 
> 
> In a message dated 7/20/2006 4:56:42 P.M. Eastern Standard Time, 
> [EMAIL PROTECTED] writes:
> 
> > Gurus-
> > i remember using the var setting in the while loop before when i 
needed to 
> > do some movement. not sure if it was pre- perl 5.7.8 or not.
> 
> i don't think it's a part of your problem, but my understanding is that 
5.7.x 
> is a developmental release of perl (as is any release with an odd 
> minor number). 
> so, if you're using perl version 5.7.8, maybe it's time to upgrade! 
unfortunately it's not always possible in a corporate setting ;)
> 
> > 
> > 
> > could anyone enlighten me as to what i must be completely overlooking 
> > that's causing the inside of the while loop t remained untouched? it 
is as 
> > if it forgets there is any information in the global array.
> > 
> > i'm trying to build a regexp here so that i can place it in a larger 
> > program.
> > 
> > ************************************************************start 
> > code**************************************
> > #! /usr/bin/perl
> > use strict;
> > use warnings;
> > 
> > my $tmp;
> > my @temp = split "\n", `sfu sho /det`;
> > 
> > if ($temp[1] =~ /Drive:/){
> >   my $drvs = 'Drives: ';
> >   my $rls = 'RAID Levels: ';
> >   my $ssz = 'Stripe Sizes: ';
> >   my $wps = 'Write Policies: ';
> > 
> >         print "blah! the array starts....
> > \t1:$temp[0]
> > \t2:$temp[1]
> > \t3:$temp[2]
> > 
> > ";
> > 
> >   # now get some of this that we want to pass on
> >   while($tmp = shift(@temp)){
> 
> if the first line is blank (not even a \n because that's what you split 
on), 
> then  $tmp  is false and the while loop will never execute. 
> (remember that a truly blank line, i.e., an empty or zero length 
> string, is false.) 
I don't remember tackling this problem before, but the suggested fixed 
worked like a charm! Definitely one I'll remember in the future!
Simply needed to add ^ to the inner loop to get all the drive information 
needed. Now I need to add in the unit and volume information to extract 
and I'll have the loop to plug in the other program. I expect this 
information will help with that too =o) Thank you!
> 
> try this: 
>     while (defined($tmp = shift(@temp))) {
> 
> if i define your sample data as a multi-line string (with an initial
> blank line) 
> and use a  defined()  test in the while loop, i get lotsa stuff 
> printed out (don't 
> know if it's correct or not, of course).   without the  defined() 
> test, nada. 
> 
> > 
> >         print "\tTEMP IS: $tmp\n";
> > 
> >     # find each drive's info
> >     if($tmp =~ /drive: (\w+)/i){
> >       $drvs .= "$1, "; # add the drive
> > 
> > 
> >       while(!(($temp[1] =~ /Drive:/i) ||
> >               ($temp[1] =~ /Unit:/i) ||
> >               ($temp[1] =~ /Volume:/i))){
> >         $tmp=shift(@temp);
> >         if($tmp =~ /Raid level:\s+(\d+)/i){ $rls .= "$1, "; }
> >         if($tmp =~ /Stripe size:\s+(\d+\s\w\w)/i){ $ssz .= "$1, "; }
> >         if($tmp =~ /Write policy:\s+(\w+\s\w+)/i){ $wps .= "$1, "; }
> >       }
> > 
> >     }
> >   # copy and paste unit/volume info
> > 
> >   }
> > 
> > print "drvs: $drvs
> > raids: $rls
> > stripes: $ssz
> > wps: $wps\n\n
> > 
> > and this should be nothing: $temp[1]
> > ";
> > 
> > }
> > ************************************************************end 
> > code**************************************
> > 
> > 
> > since i doubt anyone has SFU (a proprietary program the company i work 
for 
> > owns), there's an example, specifically what one gets on the system i 
am 
> > trying to build the regexp on.
> > 
> > while i do not have it here, the print out has an empty line 
proceeding 
> > and following the information
> 
> i think that initial empty line is the problem.   see above. 
> 
> > 
> > ************************************************************start 
> > example**************************************
> > Drive: SeaFileDrive0
> > 
> >     Formatted as NTFS
> > 
> >     Physical configuration:
> >         DAC controller:             0
> >         Adapter type:               LSI 520 (AMI 320-1)
> >         Raid level:                 5
> >         Stripe size:                128 KB
> >         Write policy:               Write through
> >         Number of spans:            1
> >         Span 0 configuration:
> >             Starting block:         0
> >             Number of drives:       12
> >             Drive size in blocks:   3727360
> >             Physical drive(s):      0-0 blocks 0 through 3727359
> >                                     0-1 blocks 0 through 3727359
> >                                     0-2 blocks 0 through 3727359
> >                                     0-3 blocks 0 through 3727359
> >                                     0-4 blocks 0 through 3727359
> >                                     0-5 blocks 0 through 3727359
> >                                     0-8 blocks 0 through 3727359
> >                                     0-9 blocks 0 through 3727359
> >                                     0-10 blocks 0 through 3727359
> >                                     0-11 blocks 0 through 3727359
> >                                     0-12 blocks 0 through 3727359
> >                                     0-13 blocks 0 through 3727359
> > 
> > Drive: SeaFileDrive1
> > 
> >     SeaFile unit:                   DVL (Drive 1 of 2)
> >     Drive data size:                1522961 MB
> >     Format signature:               SeaChange Expandable File System 
> > (SXFS)
> >     Format date/time:               21-Feb-2006 09:52:59 AM
> > 
> >     Physical configuration:
> >         DAC controller:             0
> >         Adapter type:               LSI 520 (AMI 320-1)
> >         Raid level:                 5
> >         Stripe size:                128 KB
> >         Write policy:               Write through
> >         Number of spans:            1
> >         Span 0 configuration:
> >             Starting block:         3727360
> >             Number of drives:       12
> >             Drive size in blocks:   283547648
> >             Physical drive(s):      0-0 blocks 3727360 through 
287275007
> >                                     0-1 blocks 3727360 through 
287275007
> >                                     0-2 blocks 3727360 through 
287275007
> >                                     0-3 blocks 3727360 through 
287275007
> >                                     0-4 blocks 3727360 through 
287275007
> >                                     0-5 blocks 3727360 through 
287275007
> >                                     0-8 blocks 3727360 through 
287275007
> >                                     0-9 blocks 3727360 through 
287275007
> >                                     0-10 blocks 3727360 through 
287275007
> >                                     0-11 blocks 3727360 through 
287275007
> >                                     0-12 blocks 3727360 through 
287275007
> >                                     0-13 blocks 3727360 through 
287275007
> > 
> > Drive: SeaFileDrive2
> > 
> >     Formatted as NTFS
> > 
> >     Physical configuration:
> >         DAC controller:             1
> >         Adapter type:               LSI 520 (AMI 320-1)
> >         Raid level:                 5
> >         Stripe size:                128 KB
> >         Write policy:               Write through
> >         Number of spans:            1
> >         Span 0 configuration:
> >             Starting block:         0
> >             Number of drives:       12
> >             Drive size in blocks:   3727360
> >             Physical drive(s):      0-0 blocks 0 through 3727359
> >                                     0-1 blocks 0 through 3727359
> >                                     0-2 blocks 0 through 3727359
> >                                     0-3 blocks 0 through 3727359
> >                                     0-4 blocks 0 through 3727359
> >                                     0-5 blocks 0 through 3727359
> >                                     0-8 blocks 0 through 3727359
> >                                     0-9 blocks 0 through 3727359
> >                                     0-10 blocks 0 through 3727359
> >                                     0-11 blocks 0 through 3727359
> >                                     0-12 blocks 0 through 3727359
> >                                     0-13 blocks 0 through 3727359
> > 
> > Drive: SeaFileDrive3
> > 
> >     SeaFile unit:                   DVL (Drive 2 of 2)
> >     Drive data size:                1522961 MB
> >     Format signature:               SeaChange Expandable File System 
> > (SXFS)
> >     Format date/time:               21-Feb-2006 09:52:59 AM
> > 
> >     Physical configuration:
> >         DAC controller:             1
> >         Adapter type:               LSI 520 (AMI 320-1)
> >         Raid level:                 5
> >         Stripe size:                128 KB
> >         Write policy:               Write through
> >         Number of spans:            1
> >         Span 0 configuration:
> >             Starting block:         3727360
> >             Number of drives:       12
> >             Drive size in blocks:   283547648
> >             Physical drive(s):      0-0 blocks 3727360 through 
287275007
> >                                     0-1 blocks 3727360 through 
287275007
> >                                     0-2 blocks 3727360 through 
287275007
> >                                     0-3 blocks 3727360 through 
287275007
> >                                     0-4 blocks 3727360 through 
287275007
> >                                     0-5 blocks 3727360 through 
287275007
> >                                     0-8 blocks 3727360 through 
287275007
> >                                     0-9 blocks 3727360 through 
287275007
> >                                     0-10 blocks 3727360 through 
287275007
> >                                     0-11 blocks 3727360 through 
287275007
> >                                     0-12 blocks 3727360 through 
287275007
> >                                     0-13 blocks 3727360 through 
287275007
> > 
> > Unit: SeaFileUnit0
> > 
> >     Unit size:                      3045922 MB
> >     Volume label:                   DVL
> >     Unit count of volume:           1
> >     Unit position within volume:    1
> >     Free space:                     2440093 MB
> >     Used space:                     605830 MB
> >     Max files:                      100000
> >     Min segment size:               8257536
> >     Drive(s):                       SeaFileDrive1, SeaFileDrive3
> > 
> > Volume: SeaFileVolume1
> > 
> >     Volume label:                     DVL
> >     Volume size:                      3045922 MB
> >     Free space:                       2440093 MB
> >     Used space:                       605830 MB
> >     Min segment length:               7 MB
> >     Name count:                       5457
> >     Previous validation error count:  0
> >     Previous damage flags:            none
> >     Validation error count:           0
> >     Damage flags:                     none
> >     Max files:                        100000
> >     Max file name length:             64
> >     Max brief private data length:    12
> >     Max full private data length:     2048
> >     Max system private data length:   512
> >     Max window turns per cathedral:   100
> >     Max cathedrals per basilica:      10
> > 
> >     Unit count:                       1
> >     Unit(s):                          SeaFileUnit0
> > ************************************************************end 
> > example**************************************
> > 
> > 
> > thank you in advance,
> > -Josh
> 
> hth -- bill walters 
> 
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to