Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: String to two dimensional array

by GrandFather (Saint)
on May 07, 2008 at 03:02 UTC ( #685132=note: print w/replies, xml ) Need Help??


in reply to String to two dimensional array

TIMTOWTDI:

use strict; use warnings; my $str = '0 X X X X X X X X 1 X X X X X X X X 2 X X X X X X X X 3 X X + X X X X X X 4 X X X X X X X X 5 X X X X X X X X 6 X X X X X X X X 7' +; my @array = map {[split]} $str =~ /(.{16})/g; print "@$_\n" for @array;

Prints:

0 X X X X X X X X 1 X X X X X X X X 2 X X X X X X X X 3 X X X X X X X X 4 X X X X X X X X 5 X X X X X X X X 6 X

Perl is environmentally friendly - it saves trees

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2023-09-25 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?