my $long_str = 'X' x 100000; my $capture = substr($long_str,0,50000);