Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2016-07-27 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (245 votes). Check out past polls.