in reply to Jumping out of a partially read file
Now lets say your special delimiter is a weird tie fighter thing like this :o:open(FILE,'<some_file.txt'); for((<FILE>)[0..5]){ print; }
Of course we should also check the first however many lines for the special character first to avoid slurping up the entire file if we dont find that character.open(FILE,'<some_file.txt') or die("cant open file: $!"); my $data; for(<FILE>){ if($_ !~ /:o:/){ $data .= $_; }else{ $data .= $_; last; } } close FILE;
|
|---|