in reply to matching several lines
this will only print the first "this is a test of the emergency broadcast system" and not the second one ..
No, it prints both.
undef $/;# read in whole file, not just one line or paragraph while ( <DATA> ) { while ( /AAAAAA(.*?)BBBBBB/sgm ) { print "$1\n"; } } __DATA__ hello world0 hello world1 hello world2 AAAAAA this is a test of the emergency broadcast system BBBBBB hello world0 hello world1 hello world2 AAAAAA if this had been a real emergency more instructions would have followed BBBBBB hello world0 hello world1 hello world2
this is a test of the emergency broadcast system if this had been a real emergency more instructions would have followed
|
|---|