I tried:

  #!/usr/bin/perl -w
  my $x = 25;
  printf "%-10d bytes\n", $x;
  printf "%10d bytes\n", $x;

The result is:

25         bytes
        25 bytes

Could you give more information about your system (Perl version, OS, etc.)?


Vinicius

------ Chuck <[EMAIL PROTECTED]> wrote:
> Nothing is working, I have tried every permutation.
> 
> %20s
> %-20s
> %20d
> %-20d
> 
> In fact, what you just suggested caused the number to display as a negative.
> 
> Any ideas??
> 
> -CC
> 
> ----- Original Message -----
> From: "Vinicius Jose Latorre" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Thursday, October 11, 2001 4:08 PM
> Subject: Re: Format interger printing
> 
> 
> >
> > Try:
> >
> >    printf "%10d bytes", $x;
> >
> >
> > Vinicius
> >
> > ------ Chuck <[EMAIL PROTECTED]> wrote:
> > > Arg, I am going crazy. Ok, it has been a long time since I was kneee
> deep in
> > > perl, but why does this not work:
> > >
> > >
> > > printf "%-10d bytes", $x;
> > >
> > > It does not pad the output with spaces or anything.
> > >
> > > if x = 25
> > >
> > > this is the result:
> > >
> > > 25 bytes
> > >
> > > I want it tobe:
> > >
> > >   25 bytes
> > >
> > > Anyone have any ideas. I just scanned thourgh both Programming Perl and
> the
> > > Cookbook and could not find this.
> > >
> > > Thankx,
> > > CC

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to