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-5 N/Grp'd Or BCV N/Asst'd 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 ( <DATA> ) { next unless /$pattern/; print $_ ; } __DATA__ 05F3 Not Visible ???:? 16A:CF RAID-5 N/Grp'd RW 9492 05F5 Not Visible ???:? 16A:D10 RAID-5 N/Grp'd RW 9492 0031 Not Visible ???:? 01C:C0 2-Way Mir N/Grp'd RW 9492 05FA Not Visible ???:? 16A:D0 BCV N/Asst'd RW 9492 05FC Not Visible ???:? 01A:C0 BCV N/Asst'd RW 9492 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/