it is a system app call that  populates the $EDM_nonactive_tapelist
I am not sure what you mean    "I'm not sure. "has the Orig strings in it" is not a
precise statement for a computer programmer."


the variable $EDM_nonactive_tapelist which is a file with the Orig strings in it !

the foreach with the split did work!

thanks!

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams






"Charles K. Clarkson" <[EMAIL PROTECTED]>
08/09/2004 05:41 PM

 
        To:     <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
        cc: 
        Subject:        RE: regex problem


[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

: All I am getting the error from my if statement:
: 
: ^* matches null string many times in regex; marked by <--
: HERE in m/^* <--
: HERE Orig/ at .
: 
: I am trying to get everything except *Orig in this output :
: 
: *Orig Vol: 1703FBBDED58D4AD (E00117), Seq #: 000114 in TLU:
: st_9840_acs_0, media: STK 984e
:  Orig Vol: 0303E68522777483 (E00486), Seq #: 000800 in TLU:
: st_9840_acs_0, media: STK 984e
: 
: 07/12/2004 18:13:17 Rotation
: ID:4A03CC27.A30DEE72.00000200.0E0B8707, 5
: backups
:      Media duplication is not enabled.
: 
: *Orig Vol: 4A03CC27A30DEE72 (E00632), Seq #: 000273 in TLU:
: st_9840_acs_0, media: STK 984e
: 
: Here is my code:
: 
:         foreach ($EDM_nonactive_tapelist) {
:         if ($EDM_nonactive_tapelist !~ "\^\*Orig") {
:                         print $_;
:                 }
: }
: 
: *NOTE the variable $EDM_nonactive_tapelist has the Orig strings
: in it. Does foreach read line by line?

    No. 'foreach' as used above aliases $_ to each element
of a list of scalars one item at a time. The function does
not "know" the concept of "line".

    You have provided a list of one scalar -
$EDM_nonactive_tapelist. The loop will process
$EDM_nonactive_tapelist once and place it's value in $_.
Any changes to $_ will also change $EDM_nonactive_tapelist.

    Assuming $EDM_nonactive_tapelist has a list of strings
separated by newlines ("\n"), a list of those strings
might be expressed as this.

foreach my $srting ( split /\n/, $EDM_nonactive_tapelist ) {
    print "$srting\n" if /^\*Orig/;
}

   In this example we have taken each string and placed it
in a scalar variable named $string. $string is tested and
printed if that test is true. The 'split' splits each
string at the newline and discard that character.


: Do I even need the foreach statement?

    I'm not sure. "has the Orig strings in it" is not a
precise statement for a computer programmer.


Question: How did this list of strings get into a
          single scalar?



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328



Reply via email to