On Jul 15, David Clarke said: >Hi, I have a string of text that is thousands of characters in length. >And I want to break it up into smaller records of say 500 or 600 >characters. Is there a Perl command to help to do this or am I stuck with >looping through the large input record and counting field positions >myself.
You can substr() or unpack() on the string to get the chunks. I think unpack() is the easiest, really. # this code was run with perl v5.8.4 my @chunks = unpack "(a5)*", "hello, my name is japhy"; print "<$_>\n" for @chunks; The output: <hello> <, my > <name > <is ja> <phy> -- Jeff "japhy" Pinyan % How can we ever be the sold short or RPI Acacia Brother #734 % the cheated, we who for every service http://japhy.perlmonk.org/ % have long ago been overpaid? http://www.perlmonks.org/ % -- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>