use strict; use warnings; use 5.010; my $m8 = m8_text(); eval "no strict;sub { $m8 }"; die $@ if $@; for ($m8) { s{(\@|\$\#)(?!M8PinContentSorted)(\w*M8\w+)}{${1}{\$M->{$2}}}g; s{\$(?!M8PinContentSorted)(\w*M8\w+)\[}{\${\$M->{$1}}\[}g; s{(?{$1}}g; } eval "no strict;sub { $m8 }"; die $@ if $@; say $m8; #### sub node_803848 { my ( $M, $name ) = @_; # wall of text } #### my %big_m; $big_m{M8}{M8TrackSummary} = []; # array ref $big_m{M8}{M8CurrentTrackLoc} = undef;