Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
Prematch ($`) and the m//g modifier
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="John W. Krahn, post: 4811285"] This appears to work (YMMV): #!/usr/bin/perl use strict; use warnings; while ( <DATA> ) { chomp; if ( /begin/ ) { print " $1\n--> \U$2\n" while s/(.+?)begin(.+?)end//; $_ .= ' ' . <DATA>; redo; } print " $_\n"; } __DATA__ other text1 begin part1 end other text2 begin part2 end other text3 begin part3 end other text4 begin part4 end other text5 John [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
Prematch ($`) and the m//g modifier
Top