in reply to break up text string into 70 character long tokens

Open an in-memory filehandle and do a fixed-width read.

use Data::Dumper; my $text = 'Your stuff goes here!' x 42; # filehandle to read the contents of $text open my $reader, '<', \$text; # read 70 characters at a time local $/ = \70; my @tokens = <$reader>; print "Here are my tokens:\n", Dumper(\@tokens);
  • Comment on Re: break up text string into 70 character long tokens - fun with references
  • Download Code