GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEXT::CHOMP (3)

.ds Aq ’

NAME

Text::Chomp - a module implementing a portable chomp.

CONTENTS

SYNOPSIS



    use strict;
    use warnings;
    use Text::Chomp;

    open FILE, "file.dat"
        or die "Unable to open file:  $!";

    while (<FILE>) {
        # Strip off any end of line character, not just $/
        my $line = tchomp $_;
        ...
    }

    close FILE;



DESCRIPTION

Text::Chomp implements a single function, tchomp, which will remove all known (by me, at least) line separators. chomp() works only on the value in $/, which can be difficult if working in multi-platform environments.

EXPORTS

tchomp() is the only function exported. Attempts to export other functions will cause the module to fail to load.

FUNCTIONS

tchomp CW$text

This function removes the end of line character from a line of text and returns the text. Line separators currently handled include:
\n - line feed
\r\n - carriage return/line feed
\r - carriage return
\f - form feed
\x{2028} - Unicode line separator
\x{2029} - Unicode page separator

TODO

Precompile the regular expression used for speed, and so that it can be accessed for split().

BUGS

Please report any bugs or feature requests to bug-text-chomp@rt.cpan.org, or through the web interface at <http://rt.cpan.org>. I will be notified, and then you’ll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

Original inspiration came from an ancient perlbug <http://rt.perl.org/rt3/Ticket/Display.html?id=1807>. #p5p provided some additional ideas regarding the Unicode (and a suggested name of Ch::omp). Finally, the Perl Cookbook had information on how to match the Unicode line and page separators.

COPYRIGHT & LICENSE

Copyright 2004 Steve Peters, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEXT::CHOMP (3) 2004-08-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.