[EMAIL PROTECTED] wrote:

> Can someone hlpe me clean up this trim?
>
> Rule: remove all trailing blanks and newline/LF

perldoc -q 'How do I strip blank space from the beginning/end of a
string'


>
>
> Do I need a chomp here somewhere?

No, the \s+ will take care of that


>
>
> sub trim
> { my $z = $_[0];
>
>   $z =~ s/^\s+//;

You don't need the above statement if you only need to remove trailing
blanks and newlines


>
>   $z =~ s/\s+$//;
>
>   return $z;
> }

You could maybe write the sub as
sub trim {
    s/\s+$// foreach (@_);
}

This will also trim an entire list if needed


>
>
> thanks,
> -rkl


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to