On Tue, Oct 16, 2001 at 12:56:16PM +0200, Bart Lateur wrote:
> Which reminds me... one of the less attractive features of here docs is
> the fact that the quoted document always has to end in a newline. That
> is annoying at times.
<snip>
> If there was an easy way to chomp() that newline and return the
> remainder of the string, that would solve this too. Like this?
> 
>       sub chomped ($) {
>            chomp(my $s = shift);
>            return $s;
>       }

Given that you can write chomped() in two lines, and given that you
want the trailing newline in at least 90% of all cases, doesn't that
pretty much solve the problem without a built-in?


> I don't really like this solution much. And it's not worth an extra
> keyword, for chomped() to become a built-in.

Well, as discussed briefly in an earlier thread, 
http:[EMAIL PROTECTED]/msg08514.html
if we allow ! in function names, we can distinguish between the normal
and in-place versions of functions without proliferating the number of
keywords.

    chomp! $string;                        # how chomp() currently works
    my $chomped_string = chomp $string;    # like your chomped() function


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
at last, paste for all
citizens will proclaim me
paste enema god
        -- imploded

Reply via email to