To add the 0, you can use sprintf(); $scalar = "9:59"; @temp = split /:/,$scalar; $temp[0] = sprintf(%02d,$temp[0]);
# $temp[0] now equals "09" # $temp[1] now equal "59" Now you haven't really described the nature of the data all that well, but you can probably figure it out from here. -----Original Message----- From: r To: [EMAIL PROTECTED] Sent: 3/24/02 12:34 PM Subject: how add 0 in column2 if col3 = : then join 4 fields to reassemble Need help on substitute and Join. I am breaking incoming mostly fixed layout records into pieces such that I can re JOIN them after inspecting the first 3 characters independently and changing the column 2 to make it be columns 2 and 3, with a leading 0. Problem is to 0(zero) fill the dates which come in as 9:59 10:00 10:01etc 9:59 needs to be 09:59, for consistent date length. The goal is to reassemble (join?) the resultant record and then "unpack" it which I have working, except for this shift to left when date does not have 4 digits. Remember 1:30pm also has to be fixed. I am not concerned with am pm , etc, These are day time work hours. I have tried a substitute of column 2 such as s/9/09/ if col3 is : . Didn't work., dont know how. Now trying ... ($test1, $test2, $test3) = (unpack"AAA",$array)[0,1,2]; print "$test1 $test2 $test3 test123 before \n" ; #this worked fine if ($test3 eq ":" ) { ($$test2 = 0test2) ; } #this part did not work Doesnt work either. Ideas? Then when that field is fixed, I will also have a $rest81 for the 84 char record remainder to then Join back to the first 3 fields. Then , as said, I will do the actual unpack which I have working. Thanks for any help ! R -------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]