Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Chess Board Single Loop

by aaron_baugher (Curate)
on Oct 04, 2013 at 06:49 UTC ( [id://1056841]=note: print w/replies, xml ) Need Help??


in reply to Chess Board Single Loop

To continue the silliness, here's one that hides the loop in a regex:

#!/usr/bin/env perl use strict; use warnings; $_ = '1' x 64; s{1}{ my $p=pos()+1; sprintf("%3d",$p).($p%8?'':"\n") }ge; print;

Aaron B.
Available for small or large Perl jobs; see my home node.

Replies are listed 'Best First'.
Re^2: Chess Board Single Loop
by hdb (Monsignor) on Oct 04, 2013 at 07:02 UTC

    How about this?

    print join( " ", 1..64 ) =~ s/(\d+\s?){8}\K/\n/gr;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1056841]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-23 22:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found