Aug 5, 2005, 12:26 PM
Is there a way to count characters at a time? I am trying to count 200 characters for each string, and then split those groups into a array. I know it's possible, but wanted to first check if I should try to do a loop to count, then a split once I reached say my 200th character. I'm a perl newbie, of course!
Counting Characters at at time.
I have the following:
$file = 'data.txt' ; # Name the file
open(INFO, "<$file") ; # Open the file
close(INFO) ; # Close the file
$str = <INFO>;
@snippet @snippet = split (/ /, $str); # split into an array of size 200 characters each
I guess the split commands splits at white space. Is there an easy way to manipulate the function to split at some nth character, say 200 characters?
Thanks bunches! I look forward to contributing myself wherever possible.
(This post was edited by upyeronson on Aug 5, 2005, 12:27 PM)