Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: using an array in a while loop

by BillKSmith (Monsignor)
on Jan 31, 2022 at 16:26 UTC ( [id://11140995]=note: print w/replies, xml ) Need Help??


in reply to using an array in a while loop

If the number of 'subject' folder names is small, your idea of putting them in an array has merit. Use foreach rather than while.
se strict; use warnings; my @subjects = qw(abc_001 abc_002 abc_003); foreach my $subject (@subjects) { chdir($subject) or die "Konnte Verzeichnis $subject 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(".."); }
Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11140995]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-29 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found