Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: how to to find the "/" in a string

by philiprbrenan (Monk)
on Aug 31, 2012 at 21:39 UTC ( #991093=note: print w/replies, xml ) Need Help??


in reply to how to to find the "/" in a string

Here is a start. The regular expression gets the size of the array returned by the regular expression, which uses () to enclose the text to be searched for and /g to find all the occurences.

use feature ":5.14"; use warnings FATAL => qw(all); use strict; my $h = "aaa bbb ccc aaa aaa"; say scalar (() = $h=~m(aaa)g);

Produces

3

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991093]
help
Chatterbox?
Discipulus needs to virtualize a xp home machine..
[Discipulus]: someone has experience with this? as destiation i think i'll go with virtualbox on centos
[Lady_Aleena]: Why XP?

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-05-22 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?