#!/usr/local/bin/perl use strict; use warnings; my $smp = Sample->new(greet => "hello"); print $smp->greet . "\n"; package Sample; sub new { my ($class, %hash) = @_; print $hash{greet}; my $obj = bless \%hash, $class; return $obj; } 1;