leading spaces and Perl.

talexb-SBdzbUvMQDunS0EtXVNi6w at public.gmane.org talexb-SBdzbUvMQDunS0EtXVNi6w at public.gmane.org
Fri Oct 24 17:47:18 UTC 2003


Hi Lance,

When you say that

  s/^\s//;

doesn't work (presumably to remove leading spaces), what do you mean? Are
you sure you are operating on the right variable? For example, don't do

  foreach my $line ( @lines ) {
    s/^\s//;
  }

because $line will remain untouched.

On Fri, 24 Oct 2003, 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?
>
> Lance
>
> --
> 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
>
>

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