Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

perlman:Text::Tabs

by root (Scribe)
on Dec 23, 1999 at 00:53 UTC ( #1256=perlfunc: print w/replies, xml ) Need Help??

Text::Tabs

See the current Perl documentation for Text::Tabs.

Here is our local, out-dated (pre-5.6) version:


Text::Tabs -- expand and unexpand tabs per the unix expand(1) and unexpand(1)



use Text::Tabs;

$tabstop = 4; @lines_without_tabs = expand(@lines_with_tabs); @lines_with_tabs = unexpand(@lines_without_tabs);



Text::Tabs does about what the unix utilities expand(1) and unexpand(1) do. Given a line with tabs in it, expand will replace the tabs with the appropriate number of spaces. Given a line with or without tabs in it, unexpand will add tabs when it can save bytes by doing so. Invisible compression with plain ascii!


BUGS

expand doesn't handle newlines very quickly -- do not feed it an entire document in one string. Instead feed it an array of lines.


AUTHOR

David Muir Sharnoff <muir@idiom.com>


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Eily]: you wrote boos instead of boss, and jedikaiti read that as boobs :)
[LanX]: Win claims only 8 MB left on C: how do I find out where the problem happens?
[Eily]: by Tux. And going home sounds like a good idea
[Eily]: LanX pretty much everywhere except in 8MB ?
[Eily]: s/by/bye/ someone hacked my keyboard I'm sure
[LanX]: good point! :)
[Eily]: LanX I don't understand the question though, you want to know what is taking so much space?
[Tanktalus]: Probably the swapfile :)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2017-09-20 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?