I have a big paragraph which I need to split into lines such that each line must not have more than 100 characters and no words must be broken. How would I go about doing this? I guess with regular expressions is the best way but I'm not sure how.
Use Text::Wrap.
Text::Wrap::wrap()
is a very simple paragraph formatter. It formats a single paragraph at a time by breaking lines at word boundaries. Indentation is controlled for the first line ($initial_tab
) and all subsequent lines ($subsequent_tab
) independently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With