Perl remains my go to language for a lot of kinds of tasks because its more flexible approach to data structures than the other languages that might be candidates for me (PHP, Python3), especially if it is a task where I'm having to experiment a lot to find the right approach and so am frequently revising data structures.

The big thing is that in Perl arrays and hashes act like they are infinite.

For example, you can read past the end of arrays or from non-existent hash entries and you get undef, not an error.

In a lot of applications, that is terrible. You want an error, like you get in Python. For those applications, I'd probably pick Python3 over using Perl and having to put things like "die unless exists $hash{$foo}" all over the place.

But for a lot of applications, especially involving reports where going in you don't know what you actually want or need, it is great. For instance, let's say I'm doing a report on sales. At some point I have $account (the account identifier for a customer), $service (a service we offer that they use), and $amount (the amount they ordered of the service on a particular order).

If I have a hash, "my %count", I can use it like this in Perl:

++$count{$account}{$service}{orders};
++$count{$account}{orders};
++$count{orders}
$count{$account}{$service}{total} += $amount
$count{$account}{total} += $amount;
$count{total} += $amount

In the other languages I'd have to somewhere in there explicitly do something equivalent to:

$count{$account} = {}

when I start processing $account, and

$count{$account}{$service} = {}

the first time I come across an order of $service for $account.

That doesn't seem like much, but it is noise and if I've got enough different kinds of things I'm accumulating stats on so that I've got a lot of those it gets distracting, the same way that for programs where accessing things not predefined would be a sign of a serious error putting "die unless exists $hash{$foo}" all over the place would be distracting (and so it is clearer to do those programs in Python).

Now suppose I find out that on the report I need to not only list the count for each account of their orders for each service but the order numbers of all the orders. Simple. Just change:

++$count{$account}{$service}{orders};

to

push @{$count{$account}{$service}{orders}}, $order_number;

and anyplace that was using $count{$account}{$service}{orders} as that count, change to using the length of that array (and of course add something to the final output that iterates the array and prints the order numbers in some pretty way).

If a language removes enough of these distractions, you can get into a very productive rapid experiment and feedback loop.

In a sense, I think removing distractions is kind of the point of high level languages. A distraction is anything that that is there that is not a natural part of the way a human thinks about the problem at hand but that is needed because the computer needs it. For example, memory management is a computer thing, not a human thing, so we expect high level languages to handle that.

Once that productive experimental phase is done, though, some of those things that were distractions might cease to be so. They can then become useful documentation to future readers of how the following code intended to use things.

That makes using a language like Perl, which lets you leave off those things when they are distractions, require some discipline if you use it for things that aren't one time throwaways. You need the discipline to go back and put those declarations in, or better to add some block comments explaining your final data structures. If you don't have that discipline, stay away from Perl.

But if you do, or if you are sure it is a one time throwaway, Perl can be a great choice.