2018-08-11 Athanasius restored original content:

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 (<DATA>) { 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);

In reply to Re^2: String comparison in an array by newperlbie
in thread String comparison in an array by newperlbie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.