in reply to Multiline regex for moving lines?

Note that I realize I could split this into an array, but I'm trying to find an efficient regex to do the job here. Thoughts?

How would you do it using split into an array?

The logic isn't too different using regex (maybe), just the language is different(regex, 1,2 )

I imagine something along the lines of (you fill in the blanks )

my $lineregex = qr{}ms; $input =~ s{ ( # $1 is first 3 lines $line $line $line ) ( # $2 is second 3 lines $line $line $line ) ( # $3 is third 3 lines $line $line $line ) }{$2$3$1}gx;