リストコンテキストかどうかは組み込み関数の wantarray で調べられますが、コンテキストによってスカラ(文字列)を返したり、ハッシュのリファレンスを返すには use Want すればいいと教えてもらったのでメモ。 my $server = OrenoServer->new(...); # want scalar say $server->archetyp; say "this server is ", $server->archetyp eq "core" ? "" : "not ", "core"; my $h = $server->archetyp; print Dumper $h; # want hash ref say "this server is ", $server->archetyp->{mysql} ? "" : "not ", "mysql"; my %h = %