Sorry for a stupid question, but I'm a beginner, so I can't sort out this problem.
I work with files where chunks of data are divided by lines of consecutive = signs of different length, followed by \n. I want to read these chunks as separate records, using $/ = "=+\n"; But it doesn't detect the === separator.
So my code is:
$ cat prog1
#!/usr/bin/perl
use v5.22;
use strict;
use warnings;
$/ = "=+\n";
$\="+++\n";
while (<>){
chomp;
print;
}
My data:
$ cat data1
line1
line2
===
line4
line5
My output:
$ ./prog1 data1
line1
line2
===
line4
line5
+++