Re: Replacement in a string with a function call.



K.J. 44 wrote:
What I want to do is search a string, find an IP Address, and replace
that with the DNS name.

$details[$i] =~ s/(\d+)(\.\d+)(\.\d+)(\.\d+):/&resolveDNS($1$2$3$4)/;
------------------------------------------------^

Why the '&'?

Why aren't you using strictures?

Besides that, you need the /e modifier.

perldoc perlre

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: newline to <br>
    ... Papo Napolitano wrote: ... Sure, but the description in "perldoc perlre" is more complete, ... character whatsoever, even a newline, which normally it would not match." ... Gunnar Hjalmarsson ...
    (perl.beginners)
  • Re: Interpolation problem
    ... > parenthesis error) due to more interpolation that I wanted. ... > What is the correct syntax? ... Check out perldoc perlre. ... Gunnar Hjalmarsson ...
    (comp.lang.perl.misc)
  • Re: Replacement in a string with a function call.
    ... Gunnar Hjalmarsson wrote: ... A more adequate pointer would be: ...
    (comp.lang.perl.misc)
  • Re: Variable interpolation and m in regular expression matching
    ... Gunnar Hjalmarsson wrote: ... single string. ... However the given RE does not contain a \n or any wild card ... Therefore the m modifier is of no use in this RE. ...
    (comp.lang.perl.misc)
  • Re: RegEx issue
    ... Charles DeRykus wrote: ... Those warnings are displayed if strictures are not enabled and you ... Gunnar Hjalmarsson ...
    (comp.lang.perl.misc)