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]