> -----Original Message-----
> From: Rene Verharen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 18, 2001 4:43 PM
> To: Beginners-CGI List
> Subject: Test if first character of a variable is a 0 (zero)
> 
> 
> Hi,
> 
> I need to delete the first character of a variable if this 
> (and ONLY this) 
> character is a 0 (zero).
> 
> What I tried :
> 
>     $text =~ s/01/1/;
>     $text =~ s/02/2/;
>     $text =~ s/03/3/;
>     etc...
> 
> Not what I want, because it also deletes the 0 (zero) if it 
> is NOT the 
> first character.
> 
> What should I use ?

s/^0//;

Use ^ to "anchor" the match to the beginning of the string.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to