in reply to Re^2: Problem with parameters in subroutines
in thread Problem with parameters in subroutines
This is how you would write it as a C-style for loop:
for (my $i=0; $i <= $#people; $i++) { if($people[$i]{'ident'} =~ /^1[014689]*7[014689]*5[014689]*3[01468 +9]*2[014689]*$/) { mywrite($people[$i]); #my print function } }
Comments:
In any case, I strongly recommend that you carefully read through the whole perlintro page (and especially the "Perl variable types" section); it will make learning Perl much easier than trying to figure out the basics by trial-and-error. After that, perlreftut makes for good further reading.
---
Update: Fixed link; thanks taint!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Problem with parameters in subroutines
by taint (Chaplain) on Jun 02, 2014 at 14:46 UTC |