On Mon, May 5, 2008 at 11:18 AM, Stephen Kratzer <[EMAIL PROTECTED]> wrote: snip > for (1..$n) { > if ($_ == 1 || $_ == $n) { > print "*" x $n, "\n"; > } > else { > > print "*", " " x ($n - 2), "*\n"; > } > } snip
Its time to play TIMTOWTDI: #!/usr/bin/perl use strict; use warnings; my $n = 10; my $i = $n - 2; print "*" x $n, "\n", (map "*"." " x $i."*\n", 1 .. $i), "*" x $n, "\n"; print "*" x $n, "\n", ("*", " " x $i, "*\n") x $i, "*" x $n, "\n"; -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/