sub _add_text { my ($x, $y, $text, $size) = @_; $size ||= 20; my @parts; while( $size < length $text ) { my $position = rindex $text, " ", $size; $position = $size if $position == -1; my $sub = substr $text, 0, $position; $text = substr $text, $position; push @parts, $sub; } push @parts, $text if length $text; for my $line ( @parts ){ $line = " " unless $line; prText( $x, $$y , $line ); $$y -= 15; } }