A simple example might be of use to you.

########################################
# build a name based on a counter variable with leading zeros for values
less than 10
use strict;
use warnings;

my $name;   # the name string we are building

# count from 1 to 20 for demonstration
for ( my $count = 0; $count <= 20; $count++ ) {

    $name = sprintf( '%02d', $count );

    # display the $name string
    print "$name, ";

}; # end for
##########################################

HTH

Bill Stennett

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Horst
Walther
Sent: 12 June 2006 18:03
To: [email protected]
Subject: formatted output to a variable


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!

Please help me!


Horst

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


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

Reply via email to