##Perl, 72 63 52 50 bytes ##
Perl, 72 63 52 50 bytes
My shortest version yet uses $/
to get a newline char more compactly:
$ perl -e 'print((($,="="." ="x pop.$/)=~s/./=/gr)x(1+pop))' 2 5
=====================
= = = = = =
=====================
= = = = = =
=====================
The previous update puts the mostly empty lines in the output record separator $,
, and prints a list of continuous lines.
$ perl -e 'print((($,="="." ="x pop."\n")=~s/./=/gr)x(1+pop))' 2 5
The previous version might be a bit clearer for the casual reader:
$ perl -E 'say($y=($x="="." ="x pop)=~s/./=/gr);for(1..pop){say$x;say$y}' 2 5
The first version used @ARGV
instead of pop
:
$ perl -E 'say($y=($x="="." ="x$ARGV[1])=~s/./=/gr);for(1..$ARGV[0]){say$x;say$y}' 2 5