- or download this
@array = ( "foo bar", "bar foo" );
@array2 = ( "foo", "bar" );
...
$string =~ s/($swapString)/<B>$1<\/B>/gi;
print "string after first - $string\n";
- or download this
string before - there is a foo bar and a bar foo and also foo and bar.
swapString 1 - foo bar|bar foo|foo|bar
string after first - there is a <B>foo bar</B> and a <B>bar foo</B> an
+d also <B>foo</B> and <B>bar</B>.
- or download this
$swapString = join ("|", sort { length($b) <=> length($a) } @array, @a
+rray2);