in reply to Verifying Email Addresses

# Find out if, and why not (if not):
my ($is_valid, $msg) = verify_email('$tmp_EMAIL_lc');

One possible reason the  $tmp_EMAIL_lc e-mail address is always bad is that the single-quotes of the expression  '$tmp_EMAIL_lc' do not interpolate, so what is passed to  verify_email() is always the literal string '$tmp_EMAIL_lc'.

c:\@Work\Perl\monks>perl -wMstrict -le "my $tmp_EMAIL_lc = 'this will not interpolate'; print '>$tmp_EMAIL_lc<'; " >$tmp_EMAIL_lc<
Use double-quotes or, better still, no quotes at all.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Verifying Email Addresses
by knuppn (Initiate) on Apr 04, 2019 at 19:17 UTC

    We might be getting closer. Now the response is "Cannot open socket to 'some-host-name'" and each 'some-host-name' is different.

      # This is important:
      $Email::Verify::SMTP::FROM = 'webmaster@$hostnm';

      I just noticed this statement from the OP. I haven't looked at Email::Verify::SMTP to figure out what setting this variable is supposed to do, but I just want to point out another potential single-quote vs double-quote interpolation problem.

      If the quoted statement is correct as it stands, fine. If a double-quoted string should actually be used, be aware that  @arrays double-quote interpolate:

      c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my $hostnum = [ qw(array elements will double-quote interpolate) ]; dd $hostnum; ;; my $scalar = qq{webmaster@$hostnum}; print qq{>$scalar<}; " ["array", "elements", "will", "double-quote", "interpolate"] >webmasterarray elements will double-quote interpolate<

      In this example, I have made  $hostnum an array reference. If it is not, you should get a message like

      c:\@Work\Perl\monks>perl -wMstrict -le "my $hostnum = 'not an array reference'; my $scalar = qq{webmaster@$hostnum}; print qq{>$scalar<}; " Can't use string ("not an array reference") as an ARRAY ref while "str +ict refs" in use at ...
      if you have enabled warnings and strict in your code! If you have not enabled these important Perl protective measures (and as a Perl novice, you always should), Perl will happily give you something like
      c:\@Work\Perl\monks>perl -le "my $hostnum = 'not an array reference'; my $scalar = qq{webmaster@$hostnum}; print qq{>$scalar<}; " >webmaster<
      Again, I have no idea what the quoted code should really be doing. I just want to alert you to another possible problem.

      Note that in my code examples, I use  qq{...} in place of the  "..." double-quote operator. I do this because of the way the Windoze command line (mis)handles  " (double-quote) characters. See Quote and Quote-like Operators in perlop for info on all Perl quoting operators.

      Some more very useful reading is toolic's Basic debugging checklist.


      Give a man a fish:  <%-{-{-{-<