print Dumper $_ for @{ increment(increment(\@a)) }; # Output: [ [ 1, 2 ], [ 2, 3 ] ] [ [ 2, 3 ], [ 3, 4 ] ] [ [ 3, 4 ], [ 4, 6 ] ]