in reply to Regex with Backslashes
Text::CSV may be helpful for your problem.
#!/usr/bin/perl use strict; use warnings; use Text::CSV; my $data = <<'EOF'; 1 Something\,\text\text\0x2B X 99 1,This is a problem->\\,B,2 EOF open my $fh, '<', \$data; my $csv = Text::CSV->new({sep_char => ','}); while (my $row = $csv->getline($fh)) { print "<$_> " foreach @$row; print "\n"; } __DATA__ <1> <Something\> <\text\text\0x2B> <X> <99> <1> <This is a problem->\\> <B> <2>
Greetings,
-jo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex with Backslashes
by haukex (Archbishop) on May 17, 2020 at 15:03 UTC | |
by jo37 (Curate) on May 17, 2020 at 15:13 UTC |