Sorry, i don't have an answer for your problem but this ...
$message =~ s/:\)/\<img src=\"$imagedir\/smiley.gif\"\>/g; # happy emo +ticon $message =~ s/:\(/\<img src=\"$imagedir\/sad.gif\"\>/g; # sad emoti +con ... etc. ...
Is in serious need of refactoring (for the sake of maintainence). I think it was broquaint that recommended you use a hash for this. Maybe this approach wasn't shown to you properly. The idea is to store the emoticons and just the image name (minus a path and extension). Then you can substitute all emoticons with one expression:
use CGI qw(img); my $imagedir = '/path/to/images'; my %emot = ( ':)' => 'smiley', ':(' => 'sad', ':p' => 'tongue', ':P' => 'tongue', ':o' => 'oh', ':O' => 'oh', '*hug*' => 'hug', '*flower*' => 'flower', '*wink*' => 'wink', '*devil*' => 'devil', '*love*' => 'love', '*sleep*' => 'sleep', '*conf*' => 'confused', ); my $data = do{local $/;<DATA>}; $data =~ s/ (:.|\*.*?\*) / img { src => "$imagedir\/$emot{$1}.gif", alt => $emot{$1} } /xeg ; print $data; __DATA__ stuff *sleep* :) stuff *hug* :( stuff :P :p stuff *wink* :o stuff :O stuff *flower* *devil* stuff stuff *love* *conf* stuff
This isn't perfect (doesn't catch emticons with noses), but it is a start. Please study this as it will improve your understanding of regexes, hashes, and laziness. Hope this helps :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to (jeffa) Re: database problems: repost by jeffa
in thread database problems: repost by sulfericacid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.