in reply to break up text string into 70 character long tokens
I'm not 100% on what you are asking, but I read it as you have a variable named $var1 which contains the text '$text' as well as a variable named $text which contains a long string, which you wish to break up according to some rules.
The first part of the question can be resolved using symbolic references, which are disabled under use strict and are probably not something that you should use.
The second part should be done with split combined with a regular expression. If you just want to split every 70 characters, it can be done with:
$var = 'text'; $text = 'This is not a very long string.'; my @array = (); while (${$var}) { push @array, substr ${$var}, 0, 70, undef; }
Update: Typo fixes.
|
|---|