vroom has asked for the wisdom of the Perl Monks concerning the following question:
I want to take a long string of text and split it into a two-dimensional array of $width x $height. I know of several ways to do this but none of them are as quick and dirty as I'd like them to be? Any suggestions?
Some clarification: I want to read in the data from a bitmap say a PGM file where each 'character' is a pixel. First I'm going to break the header off the string, after that I want to split the data portion into a 2-D array of $widthx$height. I know of ways to do this but am looking for something really quick and clever.
Some clarification: I want to read in the data from a bitmap say a PGM file where each 'character' is a pixel. First I'm going to break the header off the string, after that I want to split the data portion into a 2-D array of $widthx$height. I know of ways to do this but am looking for something really quick and clever.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How can I cleanly split a string of text into a two-dimensional array
by chromatic (Archbishop) on Apr 01, 2000 at 10:58 UTC | |
Re: How can I cleanly split a string of text into a two-dimensional array
by fenonn (Chaplain) on Jun 07, 2001 at 23:21 UTC | |
Re: How can I cleanly split a string of text into a two-dimensional array
by BBQ (Curate) on Dec 24, 1999 at 03:03 UTC | |
Re: How can I cleanly split a string of text into a two-dimensional array
by da w00t (Sexton) on Dec 30, 1999 at 02:24 UTC | |
Re: How can I cleanly split a string of text into a two-dimensional array
by nothingmuch (Priest) on Jan 14, 2005 at 17:07 UTC | |
Re: How can I cleanly split a string of text into a two-dimensional array
by Anonymous Monk on Dec 23, 1999 at 03:56 UTC |
Back to
Seekers of Perl Wisdom