There are two schools of thought.
1) Errors should be caught as early as possible in the development.
2) Types should be as flexible as possible to adapt to changes.
As a result there are people who are advocates for statically typed languages and there are people who are advocates for dynamically typed languages. Both has its pros and cons.
Statically typed languages (Java) should be used when things are unchanging and predictable.
Dynamically typed languages(Perl, Python) should be used when requirements are changing or unknown, or we interact with systems that change unpredictably e.g. data processing, reflection, mobile UI etc.