use strict; use warnings; package MakeObject; use Data::Dumper; my $rootDir = '/home'; my $userId = 'smith'; my $appName = 'project'; my $obj = MakeObject->new; printf "Object contents => %s\n", Dumper($obj); sub new { my $obj = bless { Root => $rootDir, UserDir => "$rootDir/Usr/$userId/", UserAppData => "$rootDir/Usr/$userId/$appName/", }, shift; return $obj; } __END__ Output is: Object contents => $VAR1 = bless( { 'Root' => '/home', 'UserDir' => '/home/Usr/smith/', 'UserAppData' => '/home/Usr/smith/project/' }, 'MakeObject' );