6 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
package Smiley; my %smilies = ( # ':)' => 'smile.gif', # ';)' => 'wink.gif', ':rolleyes:' => 'biggrin.gif' ); sub ascii_to_img { my $text = shift; for (keys %smilies) { $text =~ s/$_/<img src=\"smile\/$smilies{$_}\" \/>/g; }; return $text; } 1;
QuoteUnmatched ) in regex; marked by <-- HERE in m/;) <-- HERE
1 2 3 4 5 6 7 8 9 10 11 12 13
my %smilies = ( # ':)' => 'smile.gif', # ';)' => 'wink.gif', ':rolleyes:' => 'biggrin.gif' ); my $pattern = join '|', map quotemeta, keys %smilies; sub ascii_to_img { my $text = shift || return ''; $text =~ s/($pattern)/<img alt="$1" src="$smilies{$1}">/g; return $text; }
6 Einträge, 1 Seite |