Assuming that 'file' is a file handle and you're iterating over a file, then you'd use while (my $line=<$file>) { ... }. The range(1,4) function call translates to 1..3. So the first couple lines translates to:
while (my $line=<$file>) { for my $i (1..3) { ... stuff you want to do ... } }
That ought to get you started. Read some basic docs like perlintro to start coming up to speed.
Note: You *could* translate the first line to for my $line (<$file>) { ... } but you don't want to do that--for the for loop version, perl would read the entire file into memory before giving your code the first line. The while loop version reads a line at a time from the file, which is nearly always what you want to do.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re: Searching for Patterns in CSV
by roboticus
in thread Searching for Patterns in CSV
by Fischer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |