in reply to Getting columnwise substring from multiple lines

Update: It just struck me that using a hash for this is silly. String offsets are integers that run from 0!

#! perl -slw use strict; use Data::Dumper; my @hash; while( my $line = <DATA> ) { chomp $line; push @{ $hash[ $_ ] }, substr $line, $_, 2 for 0 .. length( $line ) -2; } print Dumper \@hash; __DATA__ ABCDEFGHIJKLM abcdefghijklm NOPQRSTUVWXYZ nopqrstuvwxyz

Ignore the code below.

#! perl -slw use strict; use Data::Dumper; my %hash; while( my $line = <DATA> ) { chomp $line; push @{ $hash{ $_ } }, substr $line, $_, 2 for 0 .. length( $line ) -2; } print Dumper \%hash; __DATA__ ABCDEFGHIJKLM abcdefghijklm NOPQRSTUVWXYZ nopqrstuvwxyz

Examine what is said, not who speaks.        The end of an era!
"But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon