On Thu, 19 Apr 2001, Mark Martin wrote:
> Hi all,
> I have sucked two substrings into two variables :
>
> $index = substr $_, 35, 11;
> $value = substr $_, 64, 6;
>
> These variables may or may not have leading zero/s :
>
> 000009/000099/000999........ and so on.
>
> If they do I need to strip away the leading zeros.
>
> Any ideas?
# Begin perl code
$index =~ s/^0+//;
$value =~ s/^0+//;
# End perl code
It reads like this:
"Apply a substitution to $index, in which any group of 1 or more zeros (0)
at the beginning of the string, are replaced with nothing".
The s/// operator is very powerful. I'd recommend reading up on it... you
can do all kinds of cool things with it.
- D
<[EMAIL PROTECTED]>