CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Print with auto indent

 



bulrush
User

Jan 15, 2015, 5:43 AM

Post #1 of 2 (1242 views)
Print with auto indent Can't Post

Perl 5.8.8 on Linux

This is something I've never done but would come in handy for debugging. I'd like to print a statement but with auto indent for long lines. Thus I'd like to print "Stored key: with long data" and the auto indent would be after the colon and space. I.e. the auto ident would align with the space after the colon but I wouldn't have to do any manual alignment in the program itself.

Is this even possible with Perl?

Example:

Code
Stored key: very long line blah blah blah say ignore extra spaces here 
wrap starts here and goes from here this is auto indent

-----


FishMonger
Veteran / Moderator

Jan 15, 2015, 6:27 AM

Post #2 of 2 (1240 views)
Re: [bulrush] Print with auto indent [In reply to] Can't Post

Text::Wrap - line wrapping to form simple paragraphs
http://search.cpan.org/~muir/Text-Tabs+Wrap-2013.0523/lib.old/Text/Wrap.pm

Text::Wrapper - Word wrap text by breaking long lines
http://search.cpan.org/~cjm/Text-Wrapper-1.05/lib/Text/Wrapper.pm

perldoc -f format
http://perldoc.perl.org/functions/format.html

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives