use warnings; use strict; use Data::Dumper; package Test; sub new { my $self = bless {}, shift; my ($uid, $root, $app) = @_; my %attrs = $self->_init($uid, $root, $app); $self = \%attrs; return $self; } sub _init { my $self = shift; my ($uid, $root, $app) = @_; my %attrs; $attrs{Root} = $root; $attrs{UserDir} = $attrs{Root} . "Usr/$uid/"; $attrs{UserAppData} = $attrs{UserDir} . "$app", return %attrs; } package main; my $test = Test->new('steve', '/home/', 'perl'); print Dumper $test;