use Modern::Perl;
say +(split ':')[0] while (<DATA>);
say (and the same goes for print which has fuller documentation) can take a FILEHANDLE as its first argument.
say FILEHANDLE LIST
print FILEHANDLE LIST
In short, the '+' indicates that the FILEHANDLE (typically STDOUT) is to be assumed and the arguments following the '+' are the LIST to be output.
Edit:
Sorry, that last paragraph was poorly worded. Hopefully, this next one is better. Also see the example code in the Update at the end.
If the FILEHANDLE is omitted, the '+' indicates that the arguments following the '+' (once expanded) are the LIST to be output. If the FILEHANDLE is included, the '+' is not required.
More complete details can be found in print
and perlop - Symbolic Unary Operators.
Regarding Modern::Perl, that will effectively do the use feature 'say'; for you; if you comment that out, you will need to do it yourself. I think that's what you were getting at; although, I did get a little lost in the multiple negatives and conditions: "the code works if ... but it doesn't unless ...".
Update:
I felt my response might have been misconstrued as being contrary to the previous responses.
This is certainly not my intention; in fact, there weren't any responses when I wrote mine.
The links to documention that I provided do give more detailed information; however, the following code examples may clarify what I was saying.
$ perl -Mstrict -Mwarnings -E 'my @x = (1,2,3); say (@x)[1]'
say (...) interpreted as function at -e line 1.
syntax error at -e line 1, near ")["
Execution of -e aborted due to compilation errors.
$ perl -Mstrict -Mwarnings -E 'my @x = (1,2,3); say STDOUT (@x)[1]'
2
$ perl -Mstrict -Mwarnings -E 'my @x = (1,2,3); say +(@x)[1]'
2
|