You don't even need the s/// since you need to test for it anyway. You could
do it something like this:


@lines =        ('before match',
                ') in psfs1 extent size 400000 next size 100000 lock mode
row;',
                'after match');

foreach (@lines)
{
        if ($_ eq ') in psfs1 extent size 400000 next size 100000 lock mode
row;')
        {
                print ');';
        }
        else
        {
                print "$_";
        }
}



> -----Original Message-----
> From: Craig Sharp [mailto:[EMAIL PROTECTED]]
> Sent: 30 November 2001 11:12
> To: [EMAIL PROTECTED]
> Subject: [Perl-unix-users] Substitution help needed
> 
> 
> Hi all,
> 
> 
> 
> 
> 
> I have several lines like the following in a file.  I need to 
> make a substitution for the line.
> 
> 
> 
> 
> 
> I am reading the file into @lines.  I then loop through 
> looking for the line.  When I find the line, I need to make 
> the change.  Then I will write it out to a new file.
> 
> 
> 
> 
> 
> Here is the line:
> 
> 
> 
> 
> 
>   ) in psfs1 extent size 400000 next size 100000 lock mode row;
> 
> 
> 
> 
> 
> I need to substitute:
> 
> 
> 
> 
> 
>   );
> 
> 
> 
> 
> 
> I cannot figure out the regexp to put into s/xxx/xxx/; so the 
> change will happen.
> 
> 
> 
> 
> 
> Thanks,
> 
> 
> 
> 
> 
> Craig A. Sharp
> 
> 
> Unix Systems Administrator
> 
> 
> DNS Administrator
> 
> 
> Roush Industries
> 
> 
> Office: 734-779-7282
> 
> 
> Cell: 734-231-6769
> 
> 
> Fax: 734-779-7807
> 
> 
> [EMAIL PROTECTED]
> 
> 
> ====================================================
> 
> 
> I have not lost my mind, it's backed up on tape somewhere!
> 
> 
> ====================================================
> 
> 
> 
> 
> 
> _______________________________________________
> Perl-Unix-Users mailing list. To unsubscribe go to 
> http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users
> 
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to