R wrote:
> 
> 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.


$ perl -le'
@time = split /:/, "9:59";
$time = sprintf "%02d:%02d", @time;
print $time;
'
09:59



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to