in reply to Indirect Object Syntax
Short demonstration of the problem:
This works as expected.#!/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;
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]
In Section
Seekers of Perl Wisdom