in reply to Re: Problem with parameters in subroutines
in thread Problem with parameters in subroutines
And i want change this foreach loop to for loop it should looks like that?foreach $guest(@people) { if($guest->{'ident'} =~ /^1[014689]*7[014689]*5[014689]*3[ +014689]*2[014689]*$/) { mywrite($guest); #my print function } }
Im thinking how i can change this loop foreach to for loop workinkg for this example im trying to do this to practise. I was reading abour foreach loop and i think here guests is a array of people and &guest are one person from this array. Is it maybe possible to do something like this?$arraylenght = lenght($guests); for($i = 0 ; i < $arraylenght ; $i++) { }
$arraylenght = lenght($guests); for($i = 0 ; i < $arraylenght ; $i++) { if($guest->{'ident'} =~ /^1[014689]*7[014689]*5[014689]*3[014689]*2[01 +4689]*$/) { mywrite($guest); #my print function } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problem with parameters in subroutines
by smls (Friar) on Jun 02, 2014 at 14:30 UTC | |
by taint (Chaplain) on Jun 02, 2014 at 14:46 UTC |