Using Your::Point
use Your::Point; # either: list of named parameters my $point = Your::Point->new( x => 10, y => 20 ); # or: hash ref of named parameters my $point = Your::Point->new({ x => 10, y => 20 }); print $point->x; # 10 print $point->y; # 20
Thus Spake Andy:
The inherited new()
method accepts either a naked list of named parameters
or a reference to a hash of named params. It Does The Right Thing™ to
make sure they end up as a hash ref to pass to init()
.