in reply to Re^3: perlmonks downloadable code blocksin thread perlmonks downloadable code blocks
True, unless you get rid of the while entirely. The first paragraph of s/// documentation reads: (Emphasis mine)
Searches a string for a pattern, and if found, replaces that pattern with the replacement text and returns the number of substitutions made.
So you get
my $post_body = ...from db...; my $match = s/.../.../ig; [download]
By the way, I don't think $match should be singular. $matches is better but not nearly as descriptive as something like $num_blks.