>>>>> "CS" == Chris Stinemetz <cstinem...@cricketcommunications.com> writes:

  CS> I would like to explicitly use printf '<%.2g>' for the element in
  CS> the array called dist.  Below is the error I am getting and below
  CS> that is a sample of the output I can currently generate before I
  CS> add printf.

  CS> Thank you

  CS> Argument "2,1,1,1175,2.58522727272727,1\n" isn't numeric in printf at 
./DOband1.pl line 47.

  CS> my @report = map 
"$_->{cell},$_->{sect},$_->{carr},$_->{chan},$_->{dist},$_->{precis}\n" , 
@sorted;

what is in @report? it is not a number. it is a string with numbers in
it along with commas and a newline

  CS>  printf '<%.2g>', @report ;

even if @report contained good data, that would only print 1
value. printf doesn't loop over its data. it only prints values for the
keys in the format string. you have only one format element in there.

if you want each value formatted, then use sprintf on each one before
you do the report. i leave that as an exercise for you.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to