I am trying to search a string for a "[]". I want to count the amount
of "[]" in the string.
Any IDeas....
$string = "a4r[]qy78[]x]y[114t"; $count = $string =~ s/\[]/\[]/g; print "$count\n" # $count will equal 2
Notice that this is not, (I repeat, not) the same as variable en passant capture
($count = $string) =~ s/\[]\[]/g;
Moral of the story: parentheses are important. Mix these two modes at your own peril (and I learned the hard way!).
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]