my ( $output ) = $char =~ /(?<=^\S{5})(\S+)(?=\S{5}\z)/; #### my ( $output ) = $char =~ /^.{5}(.*).{5}\z/s; #### my $output = substr( $char, 5, -5 );