perlquestion
kidd
I have this problem that has been driving me nuts, and I can't find the answer...<p>
Lets say I have this code:<p>
<code>
my $text = 'This test creates a [color=blue] blue [/color] word. And a [color=red] red [/color] one';
</code>
As you can see its a string with special command <code>[color=blue]</code> wich I want to substitute for "<font color="blue">" and <code>[/color]</code> to "</font>"...
<p>
Now here is the code I've been trying out:
<code>
my ($color,@colors);
my $new = $text;
@colors = $new =~ m/\[color=.*\]/gi;
print @colors;
</code>
Now...according to me "@colors" should print out:<p>
<code>
[color=blue]
[color=red]
</code>
<p>
Wich it isnt happening...could someone help me out...
THANKS