leading spaces and Perl.

Fraser Campbell fraser-Txk5XLRqZ6CsTnJN9+BGXg at public.gmane.org
Fri Oct 24 17:46:36 UTC 2003


On Friday 24 October 2003 13:42, Lance F. Squire wrote:

> I've recently found that users can enter data with leading spaces. I'm
> attempting to kill this without losing the between word spaces.
>
> s/\s+//; removes all spaces.
> s/^\s//; and s/^\s//; don't seem to work.
>
> Am I missing something?

A + in the second expression ...

    my $x = '       adsf asdf asdf adsf asdf';
    $x =~ s/^\s+//;

-- 
Fraser Campbell <fraser-Txk5XLRqZ6CsTnJN9+BGXg at public.gmane.org>                 http://www.wehave.net/
Halton Hills, Ontario, Canada                       Debian GNU/Linux

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list