> I'd like to know how many characters there are between the first and the >last "yes". The way I now come up with to do this is to use substitution to >"mark" the first and the last match, then use a counting loop to calculate >the characters......rather straightforward and stupid method.
I think there are some ways to do that,I'll give my way: $ perl -le 'my $s="syhk...yes...uhg;ka=...yes...yiealg.....yes.......ghe;a...yes...";my ($got)=$s=~/yes(.*)yes/;print length($got)' 48 Hope it helps. -- Books below translated by me to Chinese. Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/ Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>