in reply to Matching multiple occurences in one string

#!/usr/bin/perl $_ = "abcd bcde cdef defg"; # @x is a array with as much 'cde' scalars as in $_ @x = /cde/g; print "@x\n"; # count how often cde is in $_ $anz = () = /cde/g; print "$anz\n"
Boris

Replies are listed 'Best First'.
Re: Re: Matching multiple occurences in one string
by pepijn (Initiate) on Feb 29, 2004 at 12:25 UTC
    thanks, works just fine, now tuning the regex :)