#!perl use strict; use warnings; my $readfile = 'blah.csv'; my $writefile = 'bleh.csv'; my $row = <$fh>; my $found = 0; my @cols; my (@col1,@col2); my @words = split(//,@col1); open my $fh, "<", $readfile; open my $wfh, "<", $writefile; foreach (<$fh>) { tr /a-z/A-Z/; chomp; my @cols = split /\;/; push @col1, $cols[0]; push @col2, $cols[1]; if ( @col2 =~ m/$words[$_](\d+)/ ) { $found++; @words++; } open($wfh) or die "YARRG: $!"; print $wfh "$row';'@words';'$found"; $found = 0; @words = 0; } #### Applying pattern match (m//) to @array will act on scalar(@array) at C:\blah\vertailu2.pl line 24. Global symbol "$fh" requires explicit package name at C:\blah\vertailu2.pl line 8. Execution of C:\blah\vertailu2.pl aborted due to compilation errors. #### if ( @col2 =~ m/$words[$_](\d+)/ ) { $found++; @words++; }