Write a perl code to change the style of Fortran declarations. In Fortran, there are two ways to declare (for example) 2D arrays of dimensions m and n: (1) real, dimension(m,n) :: x,y (2) real :: x(m,n),y(m,n) I want you to write a Perl script that converts declarations from style (1), with the 'dimension' keyword, to style (2), without it. If a line does not contain the word 'dimension', pass it through unchanged. Note that the actual variables being declared always appear after a "::" string. The perl script should transform lines like these real(SP), dimension(:,:), intent(in out) :: a,b real(SP), dimension(:), intent(out) :: w integer(I4B) :: i,its,j,k,l,m,n,nm real(SP) :: anorm,c,f,g,h,s,scale,x,y,z real(SP), dimension(size(a,1)) :: tempm real(SP), dimension(size(a,2)) :: rv1,tempn integer, dimension(3,2) :: ivec to lines like these: real(SP), intent(in out) :: a(:,:),b(:,:) real(SP), intent(out) :: w(:) integer(I4B) :: i,its,j,k,l,m,n,nm real(SP) :: anorm,c,f,g,h,s,scale,x,y,z real(SP) :: tempm(size(a,1)) real(SP) :: rv1(size(a,2)),tempn(size(a,2)) integer :: ivec(3,2)
## Deliverables
perl script that works with version 5.6.0 of Perl on Windows XP.
## Platform
Windows XP