CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   perl script error (looping) (http://www.cfd-online.com/Forums/main/68253-perl-script-error-looping.html)

amazdeh September 11, 2009 12:47

perl script error (looping)
 
Can anyone show me how to loop through files in perl? Or cfx
I know how to use loops-but I like to apply it on files with names in numeric orders foe exampleslike

PLATEJET_InCompress_1.def
PLATEJET_InCompress_2.def
PLATEJET_InCompress_3.def


I wrote a script file- that gives me one error when it tries to rewrite the file after each loop- i have highlighed it below


COMMAND FILE:
CFX Pre Version = 11.0
END


!$num_files = 2;
! for ($i=0; $i < $num_files; $i++) {
! $n = $i + 1;
! $filename = "PLATEJET_InCompress_" . $n . ".def";
>load filename=$filename , mode=def, recoverSession=no, replaceFlow=yes, overwrite=yes > update
>importccl filename=change.ccl, mode = append, autoLoadLibrary = none

>writeCaseFile filename = "PLATEJET_InCompress_" . $n . ".def", operation=write \
solver file
> update


>close, deleteLibrary = On
> update
!}


All times are GMT -4. The time now is 20:37.