Reputation: 1
A program, that is part of a pipeline, is parsing an output text file but raises an error. Here is the code
1 open(PRED, '<', $predfile);
2 my $pred_text;
3 { local $/; $pred_text = <PRED>; }
4 close PRED;
5 my @pred_blocks = split(/^\-+$/, $pred_text);
6 foreach my $pred_block (@pred_blocks) {
7 $pred_block =~ /^>(.+)$/m or die("Internal error while parsing $predfile");
.....
}
What should contain $pred_text after line 3? I suppose the whole text file. I also suppose I should obtain different blocks from the text file, but the list in line 5 is containing only one block representing the whole file. What is the regex in line 5 doing? How it is splitting the text? And in line 7 what $pred_block =~ /^>(.+)$/m exactly mean?
Any suggestion?
Many thanks
Nino
Upvotes: 0
Views: 352
Reputation: 74008
my @pred_blocks = split(/^-+$/m, $pred_text);
, see Modifiers>
. If it doesn't, it aborts the scriptUpvotes: 5