John Mason Jr wrote:

> $var =~ s/^\s+//;

You could also get rid of leading space after each ; if you like:

$_ = '    12;    4;NA; ';
s/(^\s+|(?<=;)\s+)//g;
print "'$_'\n";

Yielding:  '12;4;NA';

> EwenMarshall wrote:
> 
>>Hi guys,
>>
>>How do I remove extra spaces from the start of a string? I won't know if or
>>how many spaces there are but I need to remove them and leave any spaces
>>after the first character:
>>
>>$var = "    12;    4;NA; ";
>># turned into:
>>$var = "12;    4;NA; ";
>>
>>I'd imagine I'll use $var =~ s/[something here]//g; but I don't know the
>>exact code.
>>
>>Thanks in advance for any help.
>>
>>Ewen
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to