in reply to Re^2: skip junk lines in csv before header
in thread skip junk lines in csv before header
use v5.12; use warnings; use Data::Dump qw/pp dd/; say pp $/; # show default say my $x = "HEADER\n" x 3 . "fieldname: BLA BLA\n" . join $/, 1..5; open my $fh, '<', \$x; # ignore anything prior to "fieldname" { local $/ = "fieldname:"; <$fh> }; say pp $/; # back to default say "-" x 10; say "fieldname:" . <$fh>; # till end of line
"\n" HEADER HEADER HEADER fieldname: BLA BLA 1 2 3 4 5 "\n" ---------- fieldname: BLA BLA
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: skip junk lines in csv before header
by AnomalousMonk (Archbishop) on Jul 28, 2022 at 15:28 UTC | |
by LanX (Saint) on Jul 28, 2022 at 15:45 UTC |