[Cedarvalley] using subs with an s///g?

Aaron Thompson thompson at cns.uni.edu
Wed Dec 10 17:47:42 CST 2003


Now to answer my own question...

the fix:

  $data =~ s/<!-- include:gallery_table -->/display_gallery_list()/eg;

... anyone know what the 'e' does (other than what I want)?

@


On Wed, Dec 10, 2003 at 05:26:56PM -0600, Aaron Thompson wrote:
> I would like to replace a string with the results of a sub
> program the idea is as follows...
> 
> I have a sub 'display_gallery_list' that returns an HTML table
> listing some galleries... and I want to replace the string 
> '<!-- include:gallery_table -->' with the results of the sub.
> Also this global replacement is preferred.
> 
> something like this should be possible:
> 
>   $data =~ s/<!-- include:gallery_table -->/&display_gallery_list/g;
> 
> I don't want to use the $` and $' variables... 
> 
> Any ideas/suggestions?
> 
> @
>   
> -- 
> Aaron Thompson   Unix Systems Administrator, College of Natural Science
> University of Northern Iowa                      Cedar Falls, IA  50614
> 
> "My doctor says that I have a malformed public-duty gland and a natural
> deficiency in moral fiber, and that I am therefore excused from saving
> Universes."  -Douglas Adams
> _______________________________________________
> Cedarvalley mailing list
> Cedarvalley at mail.pm.org
> http://mail.pm.org/mailman/listinfo/cedarvalley

-- 
Aaron Thompson   Unix Systems Administrator, College of Natural Science
University of Northern Iowa                      Cedar Falls, IA  50614

"Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so."  -Douglas Adams



More information about the Cedarvalley mailing list