Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How do I retrieve the position of the first occurrence of a match?

by lima1 (Curate)
on Oct 04, 2007 at 16:01 UTC ( [id://642691]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $line =~ m{(\d+)}g;
    my $pos = pos($line) - length $1;
    
  2. or download this
    $line =~ m{\d+};
    my $pos = length $`;
    
  3. or download this
    $line =~ m{\d+}g;
    my $pos = pos($line) - length $&;
    
  4. or download this
    $line =~ m{\d+};
    my $pos = $-[0];
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-20 01:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found