sub generate_hash { my $self; if ( ref $_[0] && @_ == 4 ) { # We were called as a method $self = shift; } my ($i, $j, $k) = @_; }