#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Mypackage; sub callingTest { my $object = new Mypackage(); return [ 200, [ "Content-Type" => "text/html" ], [ $object->test() ] ]; }; print Dumper callingTest(); __END__ $ perl main.pl $VAR1 = [ 200, [ 'Content-Type', 'text/html' ], [ 'from test' ] ];