Re: leading and trailing spaces

2000-05-05 Thread Carl Jolley
On Thu, 4 May 2000, Bill Stennett wrote: > Hi all > > sorry for this probably very basic question but i'd appreciate a little > help! > > I need to remove spaces from user input at the start and end of the string. > I can use: > >$varname=3D~s/^\s+(.*)/$1/;# remove leading spaces > >

AW: leading and trailing spaces

2000-05-04 Thread Strohmeier Ruediger
Mai 2000 15:33 > An: Perl-Win32-Users Mailing List > Betreff: leading and trailing spaces > > Hi all > > sorry for this probably very basic question but i'd appreciate a little > help! > > I need to remove spaces from user input at the start and end of the &

Re: leading and trailing spaces

2000-05-04 Thread Scott K Purcell
My preferred method of removing either leading or trailing white space for efficiency is like this: my $fish for ($fish) { s/^\s+//; s/\s+$//; } # if you have two vars for ($fish, $mamal) { s/^\s+//; s/\s+$//; } just my two cents. See the perlsyn manpage for additional info. Scott

Re: leading and trailing spaces

2000-05-04 Thread Jon Perkin
Hi Bill > I need to remove spaces from user input at the start and end of the > string. My preferred method is: $string=~s/^\s+|\s+$//g; Regards, Jon. --- You are currently subscribed to perl-win32-users as: [archive@jab.org] To unsubscribe, forward this message to [EMAIL PROTE

Re: leading and trailing spaces

2000-05-04 Thread Philip Newton
Bill Stennett wrote: > I need to remove spaces from user input at the start and end > of the string. RTFM. perldoc -q space gives two hits, one of them from perlfaq4: How do I strip blank space from the beginning/end of a string? Executive summary: use ^\s+ and \s+$ to replace blank space with

leading and trailing spaces

2000-05-04 Thread Bill Stennett
Hi all sorry for this probably very basic question but i'd appreciate a little help! I need to remove spaces from user input at the start and end of the string. I can use: $varname=3D~s/^\s+(.*)/$1/;# remove leading spaces to remove spaces at the start of the string and this works OK bu