Re: help in variable pattern matching

2007-12-19 Thread Gunnar Hjalmarsson
Jin Zhisong wrote: The following code didn't work. My $type = $ARGV[1] my $match = ( $type eq 'bcv' ) ? 'BCV' : 'RAID-5' ; my $pattern = ( $type eq 'bcv' ) ? "${match}\s+N\/Asst" : "${match}\s+N\/Grp" ; while ( )

Re: help in variable pattern matching

2007-12-19 Thread Tom Phoenix
On 12/19/07, Jin Zhisong <[EMAIL PROTECTED]> wrote: > The following code didn't work. > my $pattern = ( $type eq 'bcv' ) ? "${match}\s+N\/Asst" : > "${match}\s+N\/Grp" ; Did it not work because it did not use qr//? That's at least part of the problem. It may help you during development if yo

RE: help in variable pattern matching

2007-12-19 Thread Jin Zhisong
Thanks every one that helps. I find my problem. Now how can I have a $pattern that contain some special characters to pass it into regex? I want to extract the line that contains either RAID-5N/Grp'd Or BCV N/Asst'd The following code didn't wor

Re: help in variable pattern matching

2007-12-19 Thread Dr.Ruud
"Jin Zhisong" schreef: > I define a $match variable and use it in the patterr below. > However it didn't match anything for the sample data. perldoc -f qr -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] h

Re: help in variable pattern matching

2007-12-19 Thread Tom Phoenix
On 12/19/07, Jin Zhisong <[EMAIL PROTECTED]> wrote: >next unless /\s+BCV\s+N/Grp/; it works Oh, I hope it doesn't work. The number of forward slashes is all wrong. > next unless /\s+BCV\s+N\/Grp/; it didn't work But this one might actually parse. If it doesn't match when it's supposed

Re: help in variable pattern matching

2007-12-19 Thread Roberto Etcheverry
Jin Zhisong wrote: > HI, I'm looking for some advice of how to do this? > > > > I need to match some "variable" pattenrs so > > > > I define a $match variable and use it in the patterr below. > > However it didn't match anything for the sample data. > > > > If I change the match critia to h