# for tags like [[something]] while ($post_message =~ m%\[\[([^]]+)\]\]%gix) { if ($1 =~ /\|/) { next; } my $tmp = $1; my $val = $1; # print STDERR "\n\nFOO\n\n"; if ($DB->table('Articles')->count( { article_title => $tmp } ) > 0) { print TESTOUT "\n\nFOO 2 - gggg - $tmp \n\n"; my $article_id = $DB->table('Articles')->select( ['article_id'], { article_title => $tmp } )->fetchrow; $tmp =~ tr{&[]ÀÂÄàâäÇçÉÊÈËéêèëÏÌÎïìîÖÔÒöôòÜÛÙüûùA-Z?!;«»()" }{ aaaaaacceeeeeeeeiiiiiioooooouuuuuua-z _}; $tmp =~ s/ /_/g; $post_message =~ s/\Q[[$1]]/[[$article_id]]/sig; } else { ` # do something here latest } }