Use the following:

$option = "0" . $option if ($option / 10 < 1 && $option !~ /^0/);

~Sid

On Thu, 9 Sep 2004 08:58:36 -0500, Errin Larsen <[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> I have a variable I'm reading off of the command line:
> 
> my $option = shift;
> 
> That variable should hold a number between 1 and 31 (yes, a day of the
> month)  I am checking to make sure that the number does indeed lie in
> that range.
> 
> However, I need to pass that variable to another system command which
> expects any "day" value less than 10 to have a leading zero, so 7th
> day of the month should say '07'.  How can I check for that leading
> zero?  If it's missing, I know I could easily:
> 
> $option = "0".$option;
> 
> But I can't seem to figure out an easy, clean way to check for it.
> 
> --Thanks,
> 
> --Errin
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 



-- 
http://www.upster.blogspot.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to