Re: trim

2004-07-08 Thread John
Thanks a lot! It worked! - Original Message - From: "Bob Showalter" <[EMAIL PROTECTED]> To: "'John'" <[EMAIL PROTECTED]>; "Perl Beginners" <[EMAIL PROTECTED]> Sent: Thursday, July 08, 2004 7:07 PM Subject: RE: trim > Joh

Re: trim

2004-07-08 Thread Gunnar Hjalmarsson
John wrote: Is there any trim function that trims the spaces before and the end of the string? Not built-in in the Perl compiler. But you can use your own; I'm using this for instance: sub trim{ for ( grep defined, @_ ){ s/^\s+//; s/\s+$//; }

RE: trim

2004-07-08 Thread Bob Showalter
John wrote: > Is there any trim function that trims the spaces before and the end > of the string? There's probably a module somewhere with such a function. You can also write one simply. I usually use the following: s/^\s+//, s/\s+$// for $variable; I like that form because you can list a

Re: trim

2004-07-08 Thread Wiggins d Anconia
> > Is there any trim function that trims the spaces before and the end of the string? > perldoc -q 'strip blank space' http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: trim function

2003-06-11 Thread Dan Muey
> Hi all, > > say that > > $directory = "C:\\directory\\*.*" > > and I am trying to remove the *.* from the end using > > $directory = trim($directory); > > > where > > trim is > > sub trim { >my( $result) = @_; > > $result =~ s/^\s+(.*?)\s+$/$1/; Because . And * have special mea

Re: trim function

2003-06-11 Thread Rob Dixon
Jair Santos wrote: > Hi all, > > say that use strict;# always use warnings; # usually > $directory = "C:\\directory\\*.*" Use single quotes for cuter code. my $directory = 'C:\directory\*.*'; > and I am trying to remove the *.* from the end using > > $directory = trim($directory);