Jaya has asked for the wisdom of the Perl Monks concerning the following question:
I need to substitute the word with the corresponding number
my code is as follows
And my output isfor($i = 0,my $k = 1; $i<= $#name; ++$i,++$k){ $phylo =~ s/($name[$i])/$k/} print("$phylo \n");
9 -2393.2 ((((CH7,2),3),(4,(5,(6,7)))),((8,10),9),11);
The $name[0] is not being substituted by 1
i tried doing it explicitly and it does not work
suggestions are welcome
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Word matching in string
by Joost (Canon) on Mar 25, 2005 at 01:23 UTC | |
by Jaya (Acolyte) on Mar 25, 2005 at 01:59 UTC | |
by prasadbabu (Prior) on Mar 25, 2005 at 02:14 UTC | |
by Jaya (Acolyte) on Mar 25, 2005 at 02:25 UTC | |
by nobull (Friar) on Mar 25, 2005 at 13:41 UTC | |
|
Re: Word matching in string
by nobull (Friar) on Mar 25, 2005 at 09:20 UTC | |
|
Re: Word matching in string
by prasadbabu (Prior) on Mar 25, 2005 at 01:30 UTC |