A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Perl/perl5/issues/21716 below:

Return with a bareword compiles under strict · Issue #21716 · Perl/perl5 · GitHub

Description

return sum map { ... } @list seems to compile OK under strict without the import of List::Util::sum and returns a filehandle and a mapped list.

Steps to Reproduce
This program shows the behavior:

use warnings;
use strict;

use Data::Dumper;
# use List::Util qw{ sum };

sub xx { return sum map { $_ + 1 } 1 .. 5 }
print Dumper(xx);

The actual error occurs only after you remove return. Removing map causes it to report a warning, but it still runs.

Expected behavior

I expected to get an error about invalid bareword under strict mode, same as without return.

Perl configuration
Behavior is consistent on both perl 5.10.1 and 5.38.2.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4