in reply to form parsing, hex, HTML formatting
translates the %20 and whatnot of HTML encoding into the correct characters. This is done the with the help of the magic /e modifier ( see the library and search on egimosx for a full discussion ), which causes perl to run the REPLACEMENT part through an eval first. In this case, the pack statement is translating the 20, eg, into a space.$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
The line giving you fits is the second one, which is replacing all
newlines with 20 spaces. And yes, there is something you can do
about it :).
Try this instead:
which does exactly what you asked - substitutes$sub_body =~ s/\n/<BR>/g;
I am curious to know why they used the /i modifier on the regex, though. To the best of my knowledge, newlines do not come in upper- and lower- case flavours.
Mik
Mik Firestone ( perlus bigotus maximus )
UPDATE
Sorry - I badly misparsed the regex. Don't ask why because
I couldn't tell you for certain. It is replacing it with,
as btrott so correctly stated, a single space.
mea culpa,
Mik
|
|---|