printf FH "$key %30s", $ENV{$key}; #### print FH $key, " ", sprintf("%30s", $ENV{$key}); #### my $spaces = ' ' x ( 30 - length($key) ); print FH "$key $spaces $ENV{$key}\n";