in reply to Draw a Square With Perl!
Hello Dipseydoodle,
The only real error I can see is using eq to compare numbers. Use == instead here:
} until ($repeaty == 0);
Apart from that, the code performs as advertised. But yes, it can be done more simply (and more Perlishly). For example*:
#! perl use strict; use warnings; use constant { WIDTH => 10, HEIGHT => 10, CHAR => '.', }; for (1 .. HEIGHT) { print CHAR . ' ' for 1 .. WIDTH; print "\n"; }
Update: *Generalising a square to a rectangle.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|