How do I use sprintf to zero fill to a variable length in Perl?
        Posted  
        
            by Michael Shnitzer
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Michael Shnitzer
        
        
        
        Published on 2010-03-18T15:58:08Z
        Indexed on 
            2010/03/18
            16:01 UTC
        
        
        Read the original article
        Hit count: 300
        
perl
I want to use perl's sprintf to zerofill a variable.
sprintf("%08d", $var);
but I want the dynamically determine how many digits to zero fill.
How do I replace the "8" in sprintf("%08d", $var) with a variable called $zerofill.
Thanks.
© Stack Overflow or respective owner