You dont require regex for that use printf or sprintf
eg;
my $var=2;
$var=sprintf("%05d",$var);
print $var;
HTH
ram
On Thu, 2004-05-20 at 16:46, Singh, Ajit p wrote:
> Hello everybody,
>
> My problem is that I have a define a variable which combines two other
> variables with preceeding zeroes.
>
> i.e final_variable : <3 digit var1><5 digit var2>
>
> if var1 is single digit i have to preceed it with two zeroes. eg : 002
> if var1 is double digit i have to preceed it with one zero. eg : 022
>
> Similarly,
> for var2 is single digit i need to preceed with four zeroes .eg :00005
> for var2 is double digit i need to preceed with three zeroes .eg :00054
> for var2 is a three digit number i need to preceed with two zeroes .eg
> :00542
> and so on..
>
> can someone pls help me out on the above...
>
> ----------------------------------------------------------------------------
> ----------------
>
> regards,
>
> Ajitpal Singh,
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>