#!/usr/bin/perl -w use strict; use warnings; my @filelist = ; foreach my $file (@filelist) { open(FH,$file) or die "cant open $file: $!"; while() { if(/^.*Pseudo.*?\=(.*?$)/ .. /^.*Logical.*?\=(.{4})/sg) { print "$1,$2\n; } } close(FH); }