On Tue, 8 Aug 2000, Bart Lateur wrote:
> All you'd have to do, is set a boolean flag on the "filehandle object",
> saying: "Oi, I want this chomped.". For example:
>
> $fh->chomped(1);
>
> Then, what <$fh> would do, is read one line, looking for whatever line
> end it accepts, finish where found, and depending on whether this flag
> was set or not, remove that many characters from the end. Finito. Very
> simple, probably pretty damn fast, too. The syntax could remain:
>
> while(<$fh>) {
> ...
> }
>
> which would only terminate at the end of the file. The bare keyword
> chomp() would no longer exist.
I like this idea. How would you handle an optional parameter to specify
what gets chomped? (replacing $/, since no one seems to want it anymore)
How about:
$fh->chomp(0); # off, default
$fh->chomp(1); # on, use system newline as chomp
$fh->chomp('\r\n'); # on, use alternative
Hmm.. methinks this is starting to look unperlish.
--
Mike Pastore
[EMAIL PROTECTED]
- Re: RFC 58 (v1) C<chomp()... Dan Sugalski
- Re: RFC 58 (v1) C<chomp()... Graham Barr
- Re: RFC 58 (v1) C<chomp()>... Uri Guttman
- Re: RFC 58 (v1) C<chomp()... Jonathan Scott Duff
- Re: RFC 58 (v1) C<chomp()... Ted Ashton
- Re: RFC 58 (v1) C<chomp()... Uri Guttman
- Re: RFC 58 (v1) C<chomp()... Chaim Frenkel
- Re: RFC 58 (v1) C<chomp()>... Ted Ashton
- Re: RFC 58 (v1) C<chomp()... Jonathan Scott Duff
- Re: RFC 58 (v1) C<chomp()>... Bart Lateur
- Re: RFC 58 (v1) C<chomp()... Mike Pastore
- Re: RFC 58 (v1) C<chomp()... Michael Mathews
- Re: RFC 58 (v1) C<chomp()... Bart Lateur
- Re: RFC 58 (v1) C<chomp()... John Porter
- Re: RFC 58 (v1) C<chomp()... Bart Lateur
- Re: RFC 58 (v1) C<chomp()... John Porter
- Re: RFC 58 (v1) C<chomp()... Bart Lateur
- Re: RFC 58 (v1) C<chomp()... John Porter
- Re: RFC 58 (v1) C<chomp()... Nathan Torkington
- Re: RFC 58 (v1) C<chomp()> changes. Nathan Wiger
- Re: RFC 58 (v1) C<chomp()> changes. Ted Ashton
