#!/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) = @_; my $obj = bless \%hash, $class; return $obj; } 1;