#!/usr/bin/env perl use 5.010; use warnings; use strict; use Term::ANSIColor qw(color :constants); use Text::ANSI::Util qw/ta_wrap/; sub show { my $line = shift; my $wrapped = ta_wrap($line, 30, {flindent => q[ ] x 5, slindent => q[ ] x 5 } ); say "BEFORE:"; say $line; # print unpack('H*', $_) . ' ' for split //, $line; say ''; say "AFTER:"; say $wrapped; # print unpack('H*', $_) . ' ' for split //, $wrapped; say "\n"; } show "Marley was " . BOLD . color('green') . "dead, " . RESET . "to begin with."; show "Marley was " . color('green') . "dead, " . RESET . "to begin with."; show "Marley was " . BOLD . "dead, " . RESET . "to begin with."; show "Marley was " . UNDERLINE . color('green') . "dead, to begin with. " . RESET . "There is no doubt..."; show "Marley was " . UNDERLINE . "dead, to begin with. " . RESET . "There is no doubt...";