#!/usr/local/bin/perl use strict; use Getopt::Long; use sql_engine; my $string = "XXX2EX_"; #my (@grepnam, @names); while(<>) { chomp; if ($_ =~/SNP*/i) { #print $_, "\n"; if ($_ =~s/BM*/$string/) { print $_, "\n"; } } }
In your code this line if ($_ =~s/BM*/$string/) substitute BM* with the literal string XXX2EX_ having it in the variable $string, to prefix XXXXX change the second if condition as if ($_ =~s/(BM*)/XXXXX_$1/)
In reply to Re: regular expression ?!
by vinoth.ree
in thread regular expression ?!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |