Hi, Additional noob question: What would be wrong with
$version = '0'.$version; ? LG, Nora > -----Ursprüngliche Nachricht----- > Von: Shawn H Corey [mailto:shawnhco...@gmail.com] > Gesendet: Donnerstag, 05. August 2010 01:58 > An: beginners@perl.org > Betreff: Re: Is this perl statement valid? > > On 10-08-04 05:39 AM, Sooraj S wrote: > > Hi, > > > > My code is accepting an option "version" as an integer. If it is > less > > than 100, i need to add a zero in front of it so that i can do the > > further processing. > > > > Although this code is working, i am not sure that its the proper way. > > if ($version< 100) > > { > > # convert an integer-variable to string. > > $version = sprintf("0%d",$version); > > } > > > > I dont want to use something like my $str = sprintf("0%d",$version); > I > > want to have it in the same variable "version". > > > > > > Try: > > $version = sprintf( '%03d', $version ); > > See `perldoc -f sprinf` > > > -- > Just my 0.00000002 million dollars worth, > Shawn > > Programming is as much about organization and communication > as it is about coding. > > The secret to great software: Fail early & often. > > Eliminate software piracy: use only FLOSS. > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/