my $captured = ""; while ( ) { $captured .= $_ if ( /allsets/ .. /fs_clinical\.1/ ); }