[ back to toc ]

Removing leading zeroes

Date: 2002/05/08 09:04

How can I remove the leading zeroes from a value returned from an HTML
page? Example:050 needs to be b50. The "b" in b50 is a blank. I am new
to writting CGI script.
Assume that the string is in a Perl variable called $L. In this case you
should use Perl regular expression and theoperator 's' this way:

$L =~ s/^0+/\ /;

(Note that there is a space following the \ character.)

I did not check this code fragment, please test it and read the regular
expression and operator 's' documentation to understand how it works.

I also recommend that you listent ot the on-line audio Perl tutorial (it
is free) on the URL



[ back to toc ]