in reply to Re^2: Split file, first 30 lines only
in thread Split file, first 30 lines only

but still reads whole file.
thats what get($fullfile)does , read the whole file at once.

and i think @hippo meant

last if $line_count > 29;
Put it right after $line_count++;. You may Read the whole file via get, but then only PROCESS the beginning

Replies are listed 'Best First'.
Re^4: Split file, first 30 lines only
by wrkrbeee (Scribe) on Feb 27, 2017 at 23:16 UTC
    Thanks huck, I now understand the difference between read and process. Any thoughts on how I could approach the idea of "reading" the web page line by line? Thanks for your patience.

      Lets see if i can keep everyone happy here

      ... my $line_count=0; open (my $fh , '<', $fullfile) or die 'something'; while (my $line=<$fh>) { last if $line_count > 29; ############## needed to add this dayum chomp $line; ############## needed to add this if($line=~m/^\s*CENTRAL\s*INDEX\s*KEY:\s*(\d*)/m){$cik=$1;} if($line=~m/^\s*FORM\s*TYPE:\s*(.*$)/m){$form_type=$1;} if($line=~m/^\s*CONFORMED\s*PERIOD\s*OF\s*REPORT:\s*(\d*)/m){$ +report_date=$1;} if($line=~m/^\s*FILED\s*AS\s*OF\s*DATE:\s*(\d*)/m){$file_date= +$1;} if($line=~m/^\s*COMPANY\s*CONFORMED\s*NAME:\s*(.*$)/m){$name=$ +1;} $line_count++; print "$cik, $form_type, $report_date, $file_date, $name\n"; print "$line_count,' ', $line,' '\n"; } close $fh or die 'something'; ...
      Off the top of my head, and Untested, YMMV

        Thank you huck, I'll not bother you any more. Appreciate your help and patience. Rick