On Apr 8, 10:59 pm, char...@pulsenet.com wrote: > On Apr 8, 9:06 pm, sono...@fannullone.us wrote: > > > Three hours later, I finally had a brainstorm, and came up with the > > idea to count the number of occurrences of the words I'm looking for. > > Here's what I came up with: > > > my $str = "PO Box 6545 / 3546 Termbo Street"; > > my $address_count = 0; > > $address_count++ while ($str =~ /box|street|avenue|lane|apo/ig); > > Could say: > > print my $address_count = () = $str =~ /box|street|avenue|lane|apo/ig; > > Chris > > > > > print "$address_count\n"; > > > It's crude, and I know I'll have to tweak it, but it works. Is > > this approach O.K., or is there a better way to do it? > > > Marc- Hide quoted text - > > - Show quoted text -
This is a faq. perldoc -q occurrences Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/