This is how I would do it:

# *perl* use strict; use warnings; use Getopt::Std; our ($opt_n, $opt_g); getopt('n'); if (! $opt_n || ! $opt_g) { print "usage: $0 -n numberlist -g globpattern\n" . " where numberlist are numbers separated by commas,\n" . " e.g. -n 1203,0815,22222\n"; exit; } my %matches; $matches{$_} = 0 for split /,/, $opt_n; $opt_n =~ s/,/|/g; my $re = qr{\b($opt_n)\b}; @ARGV = <$opt_g>; # set @ARGV to found files while(<>) { my @m; @m = $_ =~ /$re/g and @matches{@m} = (1) x @m and print "$ARGV $_" +; } my @nomatch = grep { ! $matches{$_} } keys %matches; if(@nomatch) { print "$_ not matched\n" for @nomatch; }
C:\some\path>perl match.pl -n 1203,1204,1207 -g c:/perl64/myfiles/*

Of course, TIMTOWTDI (there is more than one way to do it)

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re: Bolt on where a match is not found to a print script by shmem
in thread Bolt on where a match is not found to a print script by Anonymous Monk

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.