in reply to What is clear code ?

Although your code might be a bit clearer to read, as a few other posts say, the functionality is not the same. Given this code:
my $str = "Line 1 has text, but next is an empty line:\r\n\r\nThird li +ne has text\r\n"; print "Original String:\n'$str'\n\n"; print "Ovid:\n", Ovid_Clear_MakePtag($str), "\n\n"; print "mandog:\n", MakePtag($str), "\n"; sub Ovid_Clear_MakePtag{ my $fixme = shift; # take in our parameters return join "\r\n", # join with newlines map { "<p>$_</p>" } # wrap each line in <p></p> tags grep { /\S/ } # must have at least one non-whitespace + character split "\r\n", $fixme; # break apart on the newlines } sub MakePtag{ chomp(my $fixme = shift); # take in our parameters $fixme=~s|(\r\n)|</p><p>|g; # replace all \r\n with <\p><p> $fixme = "<p>$fixme</p>"; # Add beginning and ending tags return $fixme; }
The following results are produced:
Original String: 'Line 1 has text, but next is an empty line: Third line has text ' Ovid: <p>Line 1 has text, but next is an empty line:</p> <p>Third line has text</p> mandog: </p>ine 1 has text, but next is an empty line:</p><p></p><p>Third line + has text

--Jim