Slurp Mode

The internal variable INPUT_RECORD_SEPARATOR determines which string of characters closes a line of input data.

#!/usr/bin/perl

use strict;
use warnings;
use English;

{
    local $INPUT_RECORD_SEPARATOR = '&';
    while (<DATA>) {
        print 'XXX' . $ARG . 'XXX' . "n";
    }
}

__DATA__
blarg&test&hal
lo&ende
Feedback is always welcome! If you'd like to get in touch with me concerning the contents of this article, please use Twitter.