Keep It Simple, Stupid | |
PerlMonks |
Re^3: Splitting a string to chunksby johngg (Canon) |
on Nov 29, 2006 at 23:25 UTC ( [id://586840]=note: print w/replies, xml ) | Need Help?? |
I think your "padding" algorith might be a bit wonky. Given a string of length, say, 19 characters you would arrive at a $padding value of 3, thus padding your $str with three "x"s to end up with a length of 22, not 24 as I think you wanted. This should work (not tested)
The remove padding part would be something like (again, not tested)
Cheers, JohnGG Update: I must have been half-asleep; where's the length call? Line should be
You can't do modulo on a string :)
In Section
Seekers of Perl Wisdom
|
|