Dan Sugalski said:
> Which brings up the questions:
>
> * What about scalars that didn't come from filehandles?
> * Should the chomp function use the filehandle's current separator, or the
> one in effect when it was read?
> * Do we even want to allow after-the-fact chomps, or do it automagically
at
> read time?

YES, of course!

> * Is it worth the extra space per scalar to store the record separator (or
> a pointer to the filehandle holding the record separator)?
>

What about a
    chomp($foo, '\r\n');
    # or
    chomp(<FH>, '\r\n');
syntax. The default for the second argument could be defined in a global
special variable so that "chomp $foo" would be equiv to "chomp $foo, $/" or
something.

I like the Java trim() function ( see
http://java.sun.com/products/jdk/1.1/docs/api/java.lang.String.html#trim() )
which removes whitespace from either end of the string.

Reply via email to