in reply to Re: Printing Fixed Width Strings and Spliting String into Multiple Lines
in thread Printing Fixed Width Strings and Spliting String into Multiple Lines

There's no reason to invoke something as heavy-duty as the regular expression engine when all you're working with is substrings of a given length.

my $s; print "$s\n" while $s = substr $str, 0, 100, '';
-- 
I hate storms, but calms undermine my spirits.
 -- Bernard Moitessier, "The Long Way"
  • Comment on Re^2: Printing Fixed Width Strings and Spliting String into Multiple Lines
  • Download Code

Replies are listed 'Best First'.
Re^3: Printing Fixed Width Strings and Spliting String into Multiple Lines
by mmartin (Monk) on Feb 08, 2012 at 15:54 UTC
    Hey oko1,

    I just gave your little snippet a try and it worked without any problems... Thanks!


    Thanks,
    Matt