Here is one way to do that. I chose to use List::Util's any subroutine in conjunction with a for loop.

#!/bin/env perl use strict; use warnings; use List::Util qw(any); my @small = ('var/qWDszw1dQd', 'aHO0rvbglz/pg_extra_dump', 'OtherSchem +a'); my @big = load_paths(); my @selected; for my $item (@big) { push @selected, $item if any { $item =~ /\Q$_\E/ } @small; } print "selected:\n", join "\n", @selected, "\n"; sub load_paths { return qw( ./gh/dbix-class-schema-loader/t/var/QN40VTMAuz ./gh/dbix-class-schema-loader/t/var/QN40VTMAuz/common_dump ./gh/dbix-class-schema-loader/t/var/QN40VTMAuz/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/QN40VTMAuz/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/QN40VTMAuz/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/BIdR9nVlmM ./gh/dbix-class-schema-loader/t/var/Qt5_emwFhF ./gh/dbix-class-schema-loader/t/var/Qt5_emwFhF/common_dump ./gh/dbix-class-schema-loader/t/var/Qt5_emwFhF/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/Qt5_emwFhF/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/Qt5_emwFhF/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/oc8ziKYqZb ./gh/dbix-class-schema-loader/t/var/VZa7q4FOlm ./gh/dbix-class-schema-loader/t/var/wxbUMQkA3e ./gh/dbix-class-schema-loader/t/var/wxbUMQkA3e/common_dump ./gh/dbix-class-schema-loader/t/var/wxbUMQkA3e/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/wxbUMQkA3e/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/wxbUMQkA3e/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/9Br774226y ./gh/dbix-class-schema-loader/t/var/9Br774226y/common_dump ./gh/dbix-class-schema-loader/t/var/9Br774226y/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/9Br774226y/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/9Br774226y/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/9Br774226y/common_dump/TestSch +emaFromAnother ./gh/dbix-class-schema-loader/t/var/9Br774226y/common_dump/TestSch +emaFromAnother/Result ./gh/dbix-class-schema-loader/t/var/AZzU5Mp5c8 ./gh/dbix-class-schema-loader/t/var/BrS2LkS6Wh ./gh/dbix-class-schema-loader/t/var/SN_06brsqD ./gh/dbix-class-schema-loader/t/var/sso1WR7JVK ./gh/dbix-class-schema-loader/t/var/sso1WR7JVK/common_dump ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/pg_extra_dump ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/pg_extra_dump/PGMul +tiSchema ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/pg_extra_dump/PGMul +tiSchema/Result ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/common_dump ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/common_dump/TestSch +emaFromAnother ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/common_dump/TestSch +emaFromAnother/Result ./gh/dbix-class-schema-loader/t/var/SMPvZQWwxI ./gh/dbix-class-schema-loader/t/var/ZQHeJ7xJLS ./gh/dbix-class-schema-loader/t/var/ZQHeJ7xJLS/common_dump ./gh/dbix-class-schema-loader/t/var/ZQHeJ7xJLS/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/ZQHeJ7xJLS/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/ZQHeJ7xJLS/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/qWDszw1dQd ./gh/dbix-class-schema-loader/t/var/A_asDKxIPg ./gh/dbix-class-schema-loader/t/var/MbRwgdPYzG ./gh/dbix-class-schema-loader/t/var/OKOTLfXlcS ./gh/dbix-class-schema-loader/t/var/OKOTLfXlcS/common_dump ./gh/dbix-class-schema-loader/t/var/OKOTLfXlcS/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/OKOTLfXlcS/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/OKOTLfXlcS/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/LDoLlFrpEm ./gh/dbix-class-schema-loader/t/var/xf484Q14Tm ./gh/dbix-class-schema-loader/t/var/xf484Q14Tm/common_dump ./gh/dbix-class-schema-loader/t/var/xf484Q14Tm/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/xf484Q14Tm/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/xf484Q14Tm/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/4HJSJyMOLQ ./gh/dbix-class-schema-loader/t/var/4HJSJyMOLQ/common_dump ./gh/dbix-class-schema-loader/t/var/4HJSJyMOLQ/common_dump/DBIXCSL +_Test ./gh/dbix-class-schema-loader/t/var/4HJSJyMOLQ/common_dump/DBIXCSL +_Test/Schema ./gh/dbix-class-schema-loader/t/var/4HJSJyMOLQ/common_dump/DBIXCSL +_Test/Schema/MyResult ./gh/dbix-class-schema-loader/t/var/Ta_ZGMdtD3 ./gh/dbix-class-schema-loader/t/var/PvDTGVICln ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/1 ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/1/Result ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/1/Result/MySchema ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/1/Result/OtherSchema ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/omit_timestamp ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/Upgrade ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/Upgrade/Result ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/omit_both ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpM +ore/omit_version ); } __DATA__ selected: ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/pg_extra_dump ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/pg_extra_dump/PGMultiSc +hema ./gh/dbix-class-schema-loader/t/var/aHO0rvbglz/pg_extra_dump/PGMultiSc +hema/Result ./gh/dbix-class-schema-loader/t/var/qWDszw1dQd ./gh/dbix-class-schema-loader/t/var/VSshFiOQrb/dump/DBICTest/DumpMore/ +1/Result/OtherSchema

In reply to Re: Dependant Arrays intersection by Mr. Muskrat
in thread Dependant Arrays intersection by simong

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.