Jump to content

I'm a software engineer, get me out of here: Difference between revisions

m
→‎{{header|Perl}}: eliminate hard-coded value
m (→‎{{header|Perl}}: eliminate hard-coded value)
Line 784:
use strict;
use warnings;
use List::Util qw( 'first )';
 
my $dw = join '', <DATA>, (" \n") x 40;
my $d = join '', <DATA>, " \n" x 4;
$d =~ s/.+/ sprintf "%-31s", $& /ge; # padding for single number addressing
length > $w and $w = length for split "\n", $d;
#print $d;
$d =~ s/.+/ sprintf "%-31s${w}s", $& /ge; # padding for single number addressing
$w++;
 
my $w = $d =~ /\n/ ? $+[0] : die;
sub xy { "(@{[ int $_[0] / $w ]},@{[ $_[0] % $w ]})" }
sub fromxy { $_[0] * $w + $_[1] }
2,392

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.