> PHP has a function in which the replacement of an RE match can be
> handled by the name of a given function. Does Perl have something
> similar? Should be. After all PHP calls these lots the PCRE functions.
>
> In other words, I want to do this:
>
> ===========================================
>  while(<>){
> chomp;
> s/<\d\d\d\d>/my_convert_func(\1)/g;
> print;
>  }
> ==========================================
>
> Here whatever is the return value of my_convert_func() is the
> replacement text for that particular match.
add a 'e' after the g that will evaluate the replacement expression. You can
actually do this more than once if you add more than one 'e'. My suggestion
is that you should study the regexp doc that comes with perl. I dunno how u
get it, but it shud be something like:

perldoc perlre

You can get a list of perldoc topics by running the 'perldoc' command.
It has been quite some time since I have used perl on a Linux box, so i
might not be correct about the commands. Someone please correct me if I am
wrong. Also if you are doing this under windows, the activeperl docs are
arranged as html pages, and you should be able to find the regexp docs.

Ambar
PS: RTFM

          ================================================
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject 
header. Check archives at http://www.mail-archive.com/ilugd%40wpaa.org

Reply via email to