Note that im removing the trailing newline in the split operation, which is -ew- ugly.#!/usr/bin/perl -w use strict; my $html = <<END_OF_HTML; Hello! oX World! <;<;<;<; Hi! Samn! (~) END_OF_HTML my %emotes = map {split /#####|\n/} <DATA>; for my $entry(keys %emotes) { $html =~ s!\Q$entry\E!<img src="$emotes{$entry}.gif">!g; } print $html; __DATA__ oX#####skullandbones <;#####pie (o)#####goatse (~)#####ninja
In reply to Re: Search and replace with special characters
by io
in thread [untitled node, ID 202198]
by Samn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |