I can run the following on a csv file in order to get the delimited text from the file.
#!/usr/bin/perl
use strict;
use warnings;
use Text::Balanced q/extract_delimited/;
my $filecontents = do { local $/; <> };
while (my $item = extract_delimited($filecontents, '"')) {
print "Item: $item\n";
}
but the results always include the quotes which is what I do not want so I tried the following to completely isolate the multi line record
#!/usr/bin/perl
use strict;
use warnings;
use Text::Balanced qw/gen_delimited_pat/;
my $filecontents = do { local $/; <> };
$patstring = gen_delimited_patq(\G(?:[^"]|""|""")* ]))
while (my $item = extract_delimited($filecontents, '"')) {
print "Item: $item\n";
}
since I know this regex
\G(?:[^"]|""|""")*
finds the complete multi line record that I would like to then process with Text::Markdown however I get errors that
- Use of ?PATTERN? without explicit operator is deprecated at line 10.
- Global symbol "$patstring" requires explicit package name at line 10.
- Search pattern not terminated at line 10.
I am trying to only get the delimited text for record that looks something like this excluding the beginning and ending quote I hope this makes sense:
"description" "Star-Lite 2-Person w/Fly Aluminum, Rust
Specifications:
- Packed size: 13"" X 5""
- 1 Door
- Interior Area: 41.25 sq. ft.
- Peak Height: 44""
- Floor Material: 190T polyester, 2000mm P.U. coated
- Mesh: No-see-um
- Number of poles: 2 shock corded aluminum 8.5 mm.
- Pole sections: 12"" lengths.
- Rainfly Included.
- 90"" X 66"" X 44"""
Excluding the first row I only want
Star-Lite 2-Person w/Fly Aluminum, Rust
Specifications:
- Packed size: 13"" X 5""
- 1 Door
- Interior Area: 41.25 sq. ft.
- Peak Height: 44""
- Floor Material: 190T polyester, 2000mm P.U. coated
- Mesh: No-see-um
- Number of poles: 2 shock corded aluminum 8.5 mm.
- Pole sections: 12"" lengths.
- Rainfly Included.
- 90"" X 66"" X 44""
What do I need to do to fix my pattern for this module?
EDIT: Pasted the wrong script that worked