Help for this page

Select Code to Download


  1. or download this
    @array = ( "foo bar", "bar foo" );
    @array2 = ( "foo", "bar" );
    ...
    $string =~ s/($swapString)/<B>$1<\/B>/gi;
    
    print "string after first - $string\n";
    
  2. 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>.
    
  3. or download this
    $swapString = join ("|", sort { length($b) <=> length($a) } @array, @a
    +rray2);