Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: position number

by Happy-the-monk (Abbot)
on Sep 18, 2013 at 18:12 UTC ( #1054714=note: print w/ replies, xml ) Need Help??


in reply to position number

if ($string =~ /ab|ac|ad|ba|bla|etc/) {print $1}

I guess you meant to write if ($string =~ /(ab|ac|ad|ba|bla|etc)/) {print $1}

... with a set of parantheses around what you want to match.

There's index to tell the position of a substring in a string.

Cheers, Sören

Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)


Comment on Re: position number
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054714]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2015-07-02 23:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls