my $scalar = 'test'; my $arrayref = [1,2,3]; my $hashref = { hallo => 1 }; for ($scalar, $arrayref, $hashref ){ print ref( $_ ),"\n" }