in reply to Re: pattern matching
in thread pattern matching

hi this is not wat i wanted.
$indata =~ s/XYZATGC/XYZ/g; i dont knw what string will be there after ATGC. in a string like this XYZATGCCVFGBGVFCD... as soon as ATGC is found at a particular position it should trim the entire part (including ATGC and the rest that follows it and show only the string which is XYZ and write it to new file. am i clear now


here are some exammples
input

XYZATGCACGTGFVGFCCV.......
YZXCVFDCXZATGCXCCXZZSDD
output
XYZ new file1.txt
YZXCVFDCXZ new file2.txt

Replies are listed 'Best First'.
Re^3: pattern matching
by Xiong (Hermit) on Feb 10, 2012 at 14:14 UTC

    - # Substitute as required. - $indata =~ s/XYZATGC/XYZ/g; + # This is not terribly efficient. + my @outdata = split q|ATGC|, $indata; + $indata = $outdata[0];
    I'm not the guy you kill, I'm the guy you buy. —Michael Clayton