in reply to Loops and variables?

It sounds like you're very new to the concept of programming as well.

The sprintf() function doesn't store anything. It takes in a set of input parameters and returns an output. It's a transformer, not a storehouse. You have to tell it where to store the result.

This means that you could do the following:

my @array_of_unformatted_numbers = ( 2, 5.3, 56.789, ); my @array_of_formatted_numbers = map { sprintf( "%0.2d", $_ ) } @array_of_unformatted_numbers; foreach my $formatted_number ( @array_of_formatted_numbers ) { print "The formatted number is $formatted_number.\n"; }

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?