<div>Try this.... well I use it to pad integers, haven't tried with decimals.</div>
<div> </div>
<div>sprintf("%03s", $dist);<br clear="all"></div>
<div> </div>
<div>Wes </div>
<div>---<br>The world needs more geniuses with humility because there are so few of us left.<br></div><br><br><br>
<div class="gmail_quote">On Wed, May 4, 2011 at 10:32, Andrew Rich <span dir="ltr"><<a href="mailto:vk4tec@tech-software.net">vk4tec@tech-software.net</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div bgcolor="#ffffff">
<div><font size="2" face="Arial">Wonder is someone can help</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">I want to format a number in perl </font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">3 leading 0 padded </font></div>
<div><font size="2" face="Arial">2 trailing decimal places</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">Do I have to treat to the left of the decimal point and to the right as two seperates ?</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">I want 3.4565443 to look like "003.456"</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">Working on some GPS code</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">Using sprintf </font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">This puts 3 leading and zero pads:-</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">$dist = sprintf("%3d",$dist);<br>$bearing = sprintf("%3d",$bearing);</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">This puts two trailing :-</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">print "RNG = ".sprintf("%.2f",$dist)."\n";<br>print "BRG = ".sprintf("%.2f",$bearing)."\n";</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">How do i put them together ? </font></div>
<div><font size="2" face="Arial"></font> </div>
<div> </div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">- Andrew VK4TEC -</font></div>
<div><font size="2" face="Arial"></font> </div>
<blockquote style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<div>
<div></div>
<div class="h5">
<div style="FONT: 10pt arial">----- Original Message ----- </div>
<div style="FONT: 10pt arial; BACKGROUND: #e4e4e4"><b>From:</b> <a title="vk4tec@tech-software.net" href="mailto:vk4tec@tech-software.net" target="_blank">Andrew Rich</a> </div>
<div style="FONT: 10pt arial"><b>To:</b> <a title="aprssig@tapr.org" href="mailto:aprssig@tapr.org" target="_blank">TAPR APRS Mailing List</a> </div>
<div style="FONT: 10pt arial"><b>Sent:</b> Wednesday, May 04, 2011 8:14 AM</div>
<div style="FONT: 10pt arial"><b>Subject:</b> [aprssig] perl Geo::Ellipsoid</div>
<div><br></div>
<div><font size="2" face="Arial">Hello</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">I have an idea, although not new, but novel</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">I am taking a small netbook and LINUX and a GPS.</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">I now have the flexibility to do anything with it.</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">I can program and make the netbook do what ever I want.</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">One thing I am playing with is the perl Geo::Ellispoid module.</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">This allows me to get range and bearing, and also I am working on ETA code as well.</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">- Andrew - </font></div></div></div>
<p>
<hr>
<p></p>_______________________________________________<br>aprssig mailing list<br><a href="mailto:aprssig@tapr.org" target="_blank">aprssig@tapr.org</a><br><a href="https://www.tapr.org/cgi-bin/mailman/listinfo/aprssig" target="_blank">https://www.tapr.org/cgi-bin/mailman/listinfo/aprssig</a><br>
<p></p></p></blockquote></div><br>_______________________________________________<br>aprssig mailing list<br><a href="mailto:aprssig@tapr.org">aprssig@tapr.org</a><br><a href="https://www.tapr.org/cgi-bin/mailman/listinfo/aprssig" target="_blank">https://www.tapr.org/cgi-bin/mailman/listinfo/aprssig</a><br>
<br></blockquote></div><br>