tej has asked for the wisdom of the Perl Monks concerning the following question:
I have strings in an array "@col" in all elements of this array there is one operator like "." or "+". Which is already stored in "$operator".
What i want is string on left & right side of the operator in each element of the array.
My code is likeSuppose @col contains elements like "2.2", "3.2", "1.3", "11.5" etc.. when i print left and right string for "11.5" it gives output as "1===.===.5". However I want "11===.===5"". I dont know what is wrong with the perticular pattern.foreach(@col){ my $celldata=$_; $celldata=~s/<(set|x)?aln;(.*?)>//g; $celldata=~s/<(rct|rrt|rlt)?;(.*?)>//g; $celldata=~s/(<T(?:r|c)>)//g; #print "$celldata\n"; if($celldata=~m{(.+?)$operator(.*)}){ $left_str=$1; $right_str=$2; print "$left_str === $operator + === $right_str\n"; } }
Can anybody please help me?
Thank you.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Something is wrong with this pattern
by samarzone (Pilgrim) on Dec 24, 2010 at 06:55 UTC | |
by tej (Scribe) on Dec 24, 2010 at 07:30 UTC | |
Re: Something is wrong with this pattern
by GrandFather (Saint) on Dec 24, 2010 at 06:34 UTC | |
by JavaFan (Canon) on Dec 24, 2010 at 10:34 UTC | |
by GrandFather (Saint) on Dec 24, 2010 at 21:42 UTC |