use strict; use warnings; use Data::Dump; use Text::CSV; use List::MoreUtils qw{ any }; my $first = 'computer'; my $last = 'printer'; my $in = 0; my @keys; open DATA, "types.txt" or die $!; while () { if (defined(my $key = (split)[-5])) { if ($key eq $first .. $key eq $last) { $in = 1; push @keys, $key; } elsif ($in && $key eq $last) { push @keys, $key; } else { $in = 0; } } } dd @keys; my $filename = "orders.csv"; my $csv = Text::CSV->new ( { binary => 1 } ); open my $fh, "<:encoding(Latin-1)", "orders.csv" or die "Cannot open $ +filename"; my $do_skip_test = 1; my %keyhash = map {($_=>1)} @keys; while(my $line = <$fh>) { if ($do_skip_test) { my (@fillarr1) = split ';',$line; #print $fillarr1[14]; #if ((grep { print $fillarr1[14], $_,"\n";$fillarr1[14] eq $_ +}@keys)) #need to change this loop to compare all array variables #if (($fillarr1[14] =~ /tm_C40_ANA_v1.12.0/) || ($fillarr1[14] + =~ /tm_C40_ANA_v1.14.0/)) #if (exists $fillarr1{$fillarr1[14]}) #if ($keyhash{$fillarr1[14]}) if (($fillarr1[14] =~ /$_/)@keys) { #$do_skip_test = 0; my (@fillarr) = split ';',$line; print "\n$fillarr[0]\t$fillarr[1]\t$fillarr[3]\t$fillarr[4 +]\t$fillarr[5]\t$fillarr[14]\t"; } else { next; } } } close($fh);