#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use Data::Walk; for my $arr ([ [1, 1], 2, [1, 1] ], # 10 [ 1, [4, [6]]], # 27 ) { my $sum = 0; walk sub { ref $_ or $sum += $_ * ($Data::Walk::depth - 1) }, $arr; say $sum; } #### ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,