local $/=undef; my $DataToParse = <DATA>; ... exit();
As GrandFather points out, you should be cautious about slurping files. When you do use slurping it is worth getting into the habit of making the local $/=undef; really local rather than applying from that point in your script onwards so as to avoid nasty surprises further down your code. You can do this either inside a bare code block
my $DataToParse; { local $/; $DataToParse = <DATA>; }
or, perhaps better, a do block
my $DataToParse = do { local $/; <DATA>; };
I hope this is of interest.
Cheers,
JohnGG
Update: Just noticed a horrible cut'n'paste error, there should not have been a my in the bare code block. Corrected.
In reply to Re: can I make my regex match first pattern instead of last?
by johngg
in thread can I make my regex match first pattern instead of last?
by kleucht
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |