in reply to Searching for Patterns in CSV
Please do spend some minutes reading one or two basic Perl tutorials, just because at the least it will help you formulate questions better and also allow you to make an attempt in Perl at what you want to do, and then post what you have tried, here. You'll get better help, faster, that way :)
The above post by Roboticus gives some great info on reading through the lines in a file. You'll also have to consider how to open the file for reading, how to handle an error if that fails, etc.
One of Perl's strengths is the vast public library of modules that already do most of what you need to do. There are lots of ways to open and read from a file, but like everything in Perl, you quickly reach the point at which it is more efficient to use a pre-existing module.
You might search on meta::cpan for "file", or "path", or "file open", or "file read", or something like that, and see what you get.
It is nice to be able to do in your code only this, as one example, to get to where your pseudo-code example begins:
#!/usr/bin/env perl use strict; use warnings; use File::Slurp::Tiny 'read_lines'; my $file = '/path/to/file'; for ( read_lines($file) ) { # do something }
|
|---|