Hi all,

First of all I want to thank you all for reading and
replying my previous posts.

Now I come across to another problem:

I want to print out a AoA. If I use printf I get what
I expect. If I use sprintf for string I get error
messages but the remaining still look OK. But If use
sprintf also for numbers I get nothing only error
messages. I look at the POD. It looks like sprintf and
printf are changeable to me. Any comments?

Thanks,

Li

#!c:/Perl/bin/perl.exe

use warnings;
use strict;
use Data::Dumper;

my @array=(                
                        ['A',1,2,3,4,5,6,7],
                        ['B',1,2,3,4,5,6,7],
                        ['C',1,2,3,4,5,6,7],
                                                
           );       

foreach my $r(@array){          
        foreach (@$r){
        if (/\d+/){printf "%10.2f",$_ ;
          }else{printf "%10s",$_;}
                                
          } 
          print "\n";
}

#############################################
Output1 from screen (use printf only and expected)

  A      1.00      2.00
  B      1.00      2.00
  C      1.00      2.00

Output2 from screen (use sprintf for string)

Useless use of sprintf in void context at math9.pl
line 18
      1.00      2.00
      1.00      2.00
      1.00      2.00

Output3 from screen (use sprintf for both)
Useless use of sprintf in void context at math9.pl
line 18.
Useless use of sprintf in void context at math9.pl
line 18.




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to