Skip to content

'use Foobar.12345' is undocumentedly parsed as 'use Foobar ".12345";'  #23211

@jimav

Description

@jimav

use Foobar.12345; compiles without error and calls Foobar->import("Foobar",0.12345);

I could not find any documentation of this odd behavior.

Is this old parser support for legacy version checking via the Exporter module (which calls $modname->VERSION($arg) for numeric args)? This only works for version numbers < 1.0 so maybe not.

But clearly Perl is parsing this specially.

If this is intentional then the special parsing should be documented in perlfunc ('use'). If not intentional then a parse error might be appropriate.

Steps to Reproduce

echo 'package XX;use Data::Dumper; sub import{ for(@_){print Dumper($_);} } 1;' >/tmp/XX.pm
perl -I/tmp -E 'use XX.12345;'

Result

$VAR1 = 'XX';
$VAR1 = '0.1234';

Expected result

Naively I would assume Perl would search for "XX.12345.pm" in @INC and fail if not found, or possibly complain that "XX.12345" is not a valid module name.

(Perl v5.41.4)

perl_dashV.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions