Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: skip junk lines in csv before header

by Marshall (Canon)
on Jul 24, 2022 at 17:36 UTC ( [id://11145688]=note: print w/replies, xml ) Need Help??


in reply to skip junk lines in csv before header

This code as written consumes the entire input file:
Stop reading more lines from the file once you have found the header line.
my $header_line; while (<$fh>) { next unless /^fieldname/; # skip to header line $header_line = $_; last; ####### ADDD THIS ##### }

Replies are listed 'Best First'.
Re^2: skip junk lines in csv before header
by karlberry (Sexton) on Jul 24, 2022 at 17:48 UTC
    Thank you very much. I'm sorry for my stupidity in not seeing that!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145688]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-18 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found