When you talk about an "untyped" language such as Perl, I think what you really mean is "uni-typed". There is only one type, the tagged scalar. This can be tagged as a regular scalar or as a reference and used in various ways, but at heart there is only one type in the language. That's why pack knows what to do with any value you throw at it; it takes a list of tagged scalars and creates a string according the the tags and values.
When you make a "general-purpose" function in a typed language with a powerful type system, you can have all of the convenience of a uni-typed language and the compile-time checking of a typed language. For an example,see
Haskell/Existentially quantified types.
Bottom line, it seems to me that the problems we Perlish people have with static languages come from the fact that many type systems are not as rich as they should be (C, Java). From what I've seen, ML and Haskell are moving toward the flexibility we need.