Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decode group

Status
Not open for further replies.

marcel2

Vendor
Mar 9, 2003
14
NL
I need to decode a part that comes after 333.
This is a weather code it are numbers and the part before 333 I can already decode but I need a part after the 333 and it looks the same as #1sttt what do I need to do to decode that part? This is the code I have now to decode the first part before 333.

# Groups that aren't 5 figures get deleted.
for ($I=0; $I<$#GROUPS; $I++) {
last if ($GROUPS[$I] =~ /333|444|555|ICE/);
if (length($GROUPS[$I]) != 5) { splice(@GROUPS,$I,1) }
};

#1sttt
($GROUP_ID,$S,$T)=(shift(@GROUPS) =~ /(.)(.)(...)/);
if ($GROUP_ID eq &quot;1&quot;) {
if ($T =~ /\d{3}/ and $S =~ /0|1/) {
$T=$T/10.;
if ($S) { $T=-$T }
} else {
undef $T
}
} else {
unshift(@GROUPS,$GROUP_ID.$S.$T); undef $T
};

This is after 333 but is not working.

# 1sTTT
($GROUP_ID,$Sn,$TX)=(shift(@GROUPS) =~ /(.)(.)(...)/);
if ($GROUP_ID eq &quot;1&quot;) {
if ($TX =~ /\d{3}/ and $Sn =~ /0|1/) {
$TX=$TX/10.;
if ($Sn) { $TX=-$TX }
} else {
undef $TX
}
} else {
unshift(@GROUPS,$GROUP_ID.$Sn.$TX); undef $TX
};

Hope you know the answer.

Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top