in reply to Getting columnwise substring from multiple lines

You can push directly onto the hash value,

use Data::Dumper; my %hash; my $sub_length = 2; while (<DATA>) { chomp; for my $j (0 .. length - $sub_length) { push @{$hash{$j}}, substr $_, $j, $sub_length; } } print Dumper \%hash; __DATA__ ABDC EFGH
which does what you want. I've eliminated intermediate steps and temporary variables, and replaced the C-style loop with a more perly one. The code will work even if the data lines are not all the same length. Note that the length function is called on $_ by default.

Your code appears to overwrite the results from previous data lines each time. Is that the result you see?

After Compline,
Zaxo