in reply to Split file, first 30 lines only

last if $line > 29;

See last.

Replies are listed 'Best First'.
Re^2: Split file, first 30 lines only
by wrkrbeee (Scribe) on Feb 27, 2017 at 23:01 UTC
    Thanks hippo, I understand the LAST function, but key is "WHERE" to insert this idea. Tried immediately after updating the line counter, but still reads whole file. Sorry to be so inept.

      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

        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.

      Apologies. huck is correct, it's obviously the $line_count variable which should be tested rather than $line in this instance.

      This will only stop it processing the whole file. If you don't want to download the whole file then that's a different matter entirely and would require use of a technique such as HTTP Ranges.

        Hi Hippo, your answer above states "If you don't want to download the whole file then that's a different matter entirely and would require use of a technique such as HTTP Ranges." I've tried to Google HTTP ranges but no luck. Any ideas where I get a sense of what have in mind? Nothing else seems to work (just trying to nab the few lines from web pages). Thanks!