On Tue, 14 Oct 2003 19:26:50 -0700, perl wrote:
> Can someone hlpe me clean up this trim?

What do you actually mean by "clean up"?  Make the code shorter and,
maybe, more obfuscated?  Why?

> Rule: remove all trailing blanks and newline/LF

  sub trim {
      my $string = shift;

      chomp( $string );
      $string =~ s,^\s+,,;
      $string =~ s,\s+$,,;

      return $string;
  }

This is clean _to me_, but I have no idea if you really need that chomp()
thing.  Never tested the code above.


-- 
Tore Aursand <[EMAIL PROTECTED]>


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

Reply via email to