develooper Front page | perl.beginners | Postings from October 2009

printf and zero padding

Thread Next
Harry Putnam
October 24, 2009 14:03
printf and zero padding
Message ID:
With this little script, how would I manage to get the shorter
timestamps zero padded using printf?  I now how to get padded numbers
but not when I'm pushing off the right margin too.


  use strict;
  use warnings;

  while (my $file = shift @ARGV){
    my @stat = stat $file;
    printf "%11d %s\n",$stat[9],  $file;

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About