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
>
>
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
&
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
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
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
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