Hi Bill, try s/\s+$// this cuts away the trailing blanks rather than copying everything before trailing blanks. HTH Ruediger Rüdiger Strohmeier Email: [EMAIL PROTECTED] > -----Ursprüngliche Nachricht----- > Von: Bill Stennett [SMTP:[EMAIL PROTECTED]] > Gesendet am: Donnerstag, 4. 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 > 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 but my > attempt to remove > spaces from the end does not work: > > $varname=3D~s/(.*)\s+$/$1/; # remove trailing spaces? > > (presunmably this is because (.*) matches everything includng the spaces?) > > Can anyone suggest the best way to clean up the user input. - I wish to > allow spaces > in the middle of the string and remove all whitespace from the start and > end. > > Thanks very much > > Bill Stennett > > --- > You are currently subscribed to perl-win32-users as: > [EMAIL PROTECTED] > To unsubscribe, forward this message to > [EMAIL PROTECTED] > For non-automated Mailing List support, send email to > [EMAIL PROTECTED] --- You are currently subscribed to perl-win32-users as: [archive@jab.org] To unsubscribe, forward this message to [EMAIL PROTECTED] For non-automated Mailing List support, send email to [EMAIL PROTECTED]