Hey, I've got a question about using a reference to an array in a while loop. My folders with the data from different subjects are named abc_001, abc_002, abc_003 and so on. Now I want to tell my script to go in each subfolder and do some processing steps for alle the subjects.
$i=1; while ($i<=4); {chdir ($i) or die "Konnte Verzeichnis $i nicht öffnen"; foreach ("T1_Map","T2_Map", "PD_Map", "T2STAR_Map") { system ("fslreorient2std $_.nii.gz $_._swapped.nii.gz") system ("bet $_._swapped.nii.gz $_._swappedbrain.nii.gz -m"); } chdir (".."); } continue { $i ++; }
When I name the folder with "1", "2" etc. there is no problem, but I would prefer naming them abc_001, abc_002 etc. Is there a option I define my subjects using an array and referencing them in the while loop, so the while loop uses the subjects from the array? Thanks a lot!
In reply to using an array in a while loop by perlnewbie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |