I'm sure there's a simple solution to my problem but not programing full time I'm not as learned as I'd like to be. I'm working on a script that grabs Airport weather data using Geo::METAR and formats it into a telemetry packet. Now a few of the fields are outputed from Geo::METAR in variable lengths because of changing weather conditions ie. 5 or 20 Mile per hour wind speeds. what I need to do is add leading zeros on so I have three bytes in the field once the script outputs the data ie 005 or 020.
Like I said I'm sure there's an easy way to do it but it escapes me..
My out put packet currently looks like this:
CYPE>APRS,TCPIP*,qAC,APRSFL:@100232z5614.00N/11726.00W_160/
3g...t057b10172
It should look like this:
CYPE>APRS,TCPIP*,qAC,APRSFL:@100232z5614.00N/11726.00W_160/
003g...t057b10172
Sean