OK, two points:
1) You said "improve."
While golf is “cool” for codes and, if properly studied and applied, helps a developer increase his knowledge and gnaw at the nuances and depths of a chosen language, the resulting golf code is not generally an improvement from software with development point of view.
Although good, elegant code often leads to a shorter program, the opposite is not necessarily (or usually) true. Just shortening the code most likely does not mean that the code is harder to read and complicate, and these two qualities are pretty much important for good software development.
2) Having said that, Perl provides many syntax tools and idioms that provide better code, reducing it as a side effect. I will try to point out some possible changes to your code that will make it more idiomatic, in my opinion, although not necessarily shorter.
OLD:
my @input_arr = (); push @input_arr, @$arr_ref;
NEW:
my @input_arr = (@$arr_ref);
Explanation: You do not need to declare an array and initialize it separately.
OLD:
if (scalar(@input_arr) <= 1) {
NEW:
if (@input_arr <= 1) {
Explanation: Arrays in Perl, if evaluated in the scaalar context (which uses the numerical comparison operator, for example, <= ), evaluate the size of the array. So scalar() is redundant.
More to add later - you need to run
source share