http://qs321.pair.com?node_id=11138528


in reply to Indirect Object Syntax

Short demonstration of the problem:

#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; sub new {} { package MyObj; sub new { bless { name => $_[1] }, $_[0] } sub string { join ', ', values %{ $_[0] } } } say 'MyObj'->new('obj1')->string; say new MyObj('obj2')->string;
This works as expected.
obj1 obj2

Now try moving the package definition to the end of the code.

obj1 Undefined subroutine &main::MyObj called at ... line 9.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]