Please run the code below and see if you get the same output as I do (also below). If so, I would like to know why it is behaving as it is.

#!/usr/local/perl -w use strict; my $filename1 = 'FILE.pgp'; my $filename2 = 'FILE.gpg'; my $signer = 'Some person <someone@this.com>'; my $exp_sender= ''; my $new_filename1 = $filename1; $new_filename1 =~ s/(\.gpg)|(\.encrypted)/\.decrypted/; print ".PGP FILE ERROR:'$signer' is not '$exp_sender'.\n" unless ($signer =~ m/\Q$exp_sender\E/); my $new_filename2 = $filename2; $new_filename2 =~ s/(\.gpg)|(\.encrypted)/\.decrypted/; print ".GPG FILE ERROR:'$signer' is not '$exp_sender'.\n" unless ($signer =~ m/\Q$exp_sender\E/); my $new_filename3 = $filename1; $new_filename3 =~ s/(\.gpg)|(\.encrypted)/\.decrypted/; print ".PGP ERROR, why the second time but not the first?:'$signer' is + not '$exp_sender'.\n" unless ($signer =~ m/\Q$exp_sender\E/); 1;

And below is the out put I get from the above script

$ perl match_test.pl .GPG FILE ERROR:'Some person <someone@this.com>' is not ''. .PGP ERROR, why the second time but not the first?:'Some person <someo +ne@this.com>' is not ''.

the_Don
...making offers others can't rufuse.


In reply to Re: Re: Regular Expression gotchas ? by the_Don
in thread Regular Expression gotchas ? by the_Don

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.