Alistair, The input data consists of numeric strings created in two different formats form two different platforms, one having leading signs and one having trailing signs. The commify will ignore the trailing signs, which is fine for my requirements, unless someone wants to propose another regex to swap the signs, i.e. either make all output strings have leading or trailing signs, regardless of input. I changed my mind on the justification, the commify construct alters the length in a manner that could result in a string that is longer than the input, for the program which utilizes this sub, I fould it more pleasant to see all of the strings left-justified, i.e.
-------------------------------------------------------------------------------- 1: 1-4: 4:N:160 Record ID 160 2: 5-9: 5:A:160 Type Of Service >COOP < 3: 10-10: 1:A:160 Reading Activity Code >R< 4: 11-25: 15:A:160 Meter Number >17778 < 5: 26-40: 15:A:160 Secondary Meter Number > < 6: 41-42: 2:N:160 Position Number 1 7: 43-47: 5:A:160 Rate Schedule >RES < 8: 48-48: 1:N:160 Meter Type 0 9: 49-51: 3:A:160 Who Read Meter Code >5 < 10: 52-52: 1:N:160 Electrical Use Code 0 11: 53-53: 1:N:160 Number Of Dials 5 12: 54-62: 9:4:160 Multiplier 1.0000 13: 63-71: 9:N:160 Present Reading 38,512 14: 72-79: 8:D:160 Present Reading Date 02-04-2002 15: 80-80: 1:A:160 Present Reading Code >0< 16: 81-89: 9:N:160 Previous Reading 38,140 17: 90-97: 8:D:160 Previous Reading Date 01-09-2002 18: 98-98: 1:A:160 Previous Reading Code >0< 19: 99-107: 9:S:160 KWH Usage 372+ 20:108-116: 9:S:160 Revenue 40.14+ 21:117-125: 9:4:160 KVAR Multiplier 0.0000 22:126-134: 9:2:160 KVAR Previous Reading 0.00 23:135-143: 9:2:160 KVAR Present Reading 0.00 24:144-152: 9:S:160 KVAR Usage 0.00+ 25:153-172: 20:A:160 Map Location >162-24-18 < 26:173-174: 2:N:160 Register Number 1 27:175-179: 5:N:160 Reading Number 0 28:180-180: 1:A:160 End Of Record >X< -------------------------------------------------------------------------------- Based upon a suggestion from $Bill on argument handling, the latest revision is: sub ZeroSuppress($;$) { local $_ = $_[0]; # If the argument for the decimal point exists, insert a decimal point # at the specified location. s/(\d{$_[1]})([-+]?)$/\.$1$2/ if ($_[1]); # Zero-suppress the string. s/\b0+(?=\d)//; # Remove leading spaces. s/([-+]?)\s*/$1/; # Insert comma separators. 1 while s/^([-+]?\d+)(\d{3})/$1,$2/; return($_); } Dirk Bremer - Systems Programmer II - ESS/AMS - NISC St. Peters 636-922-9158 ext. 652 fax 636-447-4471 [EMAIL PROTECTED] www.nisc.cc _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs