leading spaces and Perl.

Lance F. Squire lance-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Fri Oct 24 17:55:43 UTC 2003


talexb-SBdzbUvMQDunS0EtXVNi6w at public.gmane.org wrote:
> 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.
> 

Test code in question.

$Uname = $DB->quote($Uname);
print "Uname='$Uname'\n<br>";
#Kill leading and trailing spaces
$Uname =~ s/^\s+//;
print "Remove leading spaces = '$Uname'<br>\n";
$Uname =~ s/\s+$//;
print "Remove trailing spaces = '$Uname'<br>\n";

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