Question 2: Perl version
use 5.014; my $bits = `cat 02-square-bits`; my $s = int(sqrt(length($bits))); my @lines = $bits =~ m/(.{$s})/g; open STDOUT, '|-', 'less', '-p', '[.]'; foreach (@lines) { s/0/ /g; s/1/../g; say; } close(STDOUT);
use 5.014; my $bits = `cat 02-square-bits`; my $s = int(sqrt(length($bits))); my @lines = $bits =~ m/(.{$s})/g; open STDOUT, '|-', 'less', '-p', '[.]'; foreach (@lines) { s/0/ /g; s/1/../g; say; } close(STDOUT);