"Lawrence, Rob" wrote:
>
> Hi all,
>
> I seem to be having a problem separating variables with whitespace. I
> though I had a field delimited file, so I just counted the field widths and
> used the script below to strip off the white space on the variables I needed
> evaluate. I did try to use the \w escape character, I might have been using
> in the wrong context...below is my pitiful script to strip off white space,
> I am pretty sure there is a quick an easy and more reliable way to do this.
> Any input is appreciated...
>
> --Rob
>
> $i=0;
> $chrs = $serv;
> while ($chrs =~ /[a-zA-z0-9\.\-]/)
> {
> $chrs = substr($serv,$i,1);
> $i= $i+1;
> }
> $i=$i-1;
> $serv = substr($serv,0,$i);
> $i=0;
>
>
> $chrs = $status;
> while ($chrs =~ /[a-zA-z0-9\.\-]/)
> {
> $chrs = substr($status,$i,1);
> $i= $i+1;
> }
> $i=$i-1;
> $status = substr($status,0,$i);
I have no idea of what you are doing here, but here is what I would use to
remove WS from a vrbl:
$var =~ s/^\s+//; # remove leading WS
$var =~ s/\s+$//; # remove trailing WS
# $var =~ s/\s{2,}/ /g; # optionally replace mult embedded WS chars with 1 blank
--
,-/- __ _ _ $Bill Luebkert ICQ=14439852
(_/ / ) // // DBE Collectibles http://www.todbe.com/
/ ) /--< o // // Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/_<_</_</_ http://www.freeyellow.com/members/dbecoll/
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web