Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Printing ten characters succeeding a matching string

by roboticus (Chancellor)
on Oct 27, 2011 at 19:51 UTC ( [id://934225]=note: print w/replies, xml ) Need Help??


in reply to Printing ten characters succeeding a matching string

bluray:

Look at the "Capture Buffers" section of perldoc perlre and you'll see how to do it. Here's a quick example:

$ cat foo.pl my $t='the quick red fox jumped over the lazy brown dog.'; if ($t=~/fox(.{10})/) { print "The 10 characters after fox are '$1'\n"; } $ perl foo.pl The 10 characters after fox are ' jumped ov'

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found