> Hi, dear colleagues.
> In a script I wish to build a name (string), which consists also an 
> countervalue, derived from a loop counter. 
> For the small values (0 to 9) shall the string consist the leading zero (00 
> .... 09). 
> Whats to do?  
> At the moment I dont see the solution, so big the door is!

People have suggested using sprintf(), but there is another possibility, as the 
following code suggests:

for (my $count = "00"; $count lt "10"; $count++)  {
      print "name$count\n";
}

See the description of the increment operator in perlop for more details.

--
Eric Amick
Columbia, MD

 
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to