This data is suitable for use as a <TMPL_LOOP> in a template prepared for HTML::Template. It is a reference to an array of hashes. Each hash holds the data from one record in your dataset. The keys of the hash are the table columns specified in your SELECT statement.use Data::Dumper; die Dumper $rows; __DATA__ $VAR1 = [ { 'locked' => 'no', 'stick' => 'quux', 'last_update' => '2004-05-17 00:24:28', 'name' => 'qux', 'post' => 'foo', 'author' => 'baz', 'last_updated_by' => 'joe', 'view' => 'bar', 'id' => '1' } ];
See the pod for Regexp::Common for an explanation of $RE{profanity} and other regular expressions it provides.use Regexp::Common 'RE_profanity'; + foreach my $row ( @$rows ) { # $row is a hash reference containing the # data from a single record $row->{post} =~ s/$RE{profanity}/[censored]/g; } + use Data::Dumper; die Dumper $rows; __DATA__ $VAR1 = [ { 'locked' => 'no', 'stick' => 'foobar', 'last_update' => '2004-05-17 00:33:55', 'name' => 'post with curses', 'post' => 'some [censored] [censored] words', 'author' => 'values', 'last_updated_by' => 'jack', 'view' => 'other', 'id' => '2' } ];
In reply to Re: Modifying data in a hash before sending to template
by sacked
in thread Modifying data in a hash before sending to template
by Steny
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |