in reply to Re^2: Reading a file with 8kB long lines
in thread Reading a file with 8kB long lines
I'd do something like:
Update: replace the $full_line .= line withmy $full_line = ''; while ( my $line = <FH> ) { chomp $line; next if substr( $line, 0, 2 ) eq '//'; $full_line .= " $line"; # space wanted? your call! next unless substr( $line, -1, 1 ) eq ';'; #do something with $full_line print "$full_line\n"; $full_line = ''; }
$full_line .= $full_line eq '' ? $line : " $line";
Update^2: I should have said this has been tested and produced the following with your sample data:
some code; more code; some very long long long code;
|
|---|