MissPerl has asked for the wisdom of the Perl Monks concerning the following question:
I was wondering is there a way I can do this,
like.. for i = 0 to 10
next i
so that I am able to change $name1 to $name2 ....... and also $age1 to age2 ... ?
I did a little of searching and found that there is way to work for only array ?EDIT:if ( $name1 = "") { $age1 = ""; }
I tried this but its not working.@student = (\$name1, \$name3, \$name5, \$name7, \$name9, \$name11); @all = (\$age1, \$age2, \$age3, \$age4, \$age5, \$age6); for ($i = 0; $i = 5; $i++){ if ( $student[$i] ... ) { $all[$i] = ""; }elsif ($student[$i] ... ) { $all[$i] = ""; }elsif ($student[$i] ... ) { $all[$i] = ""; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl for loop
by 1nickt (Canon) on Jun 01, 2017 at 03:59 UTC | |
by MissPerl (Sexton) on Jun 02, 2017 at 07:15 UTC | |
by AnomalousMonk (Archbishop) on Jun 02, 2017 at 08:46 UTC | |
Re: Perl for loop
by NetWallah (Canon) on Jun 01, 2017 at 05:42 UTC | |
Re: Perl for loop
by choroba (Cardinal) on Jun 02, 2017 at 08:48 UTC | |
Re: Perl for loop
by LanX (Saint) on Jun 01, 2017 at 14:00 UTC |