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

printf and zero padding

Thread Next
From:
Harry Putnam
Date:
October 24, 2009 14:03
Subject:
printf and zero padding
Message ID:
87fx985wuh.fsf@newsguy.com
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.

cat script.pl

  #!/usr/local/bin/perl
  use strict;
  use warnings;

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


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About