I had a need to read one of the code snippets I posted a while back (perl) and noticed the syntax highlighter has screwed up the code I posted by adding an extra backslash making the snippet no good. I thought I would just try and edit the snippet but there is no longer an edit link like there used to be. What to do?

Recommended Answers

All 7 Replies

Due to abuse, the edit button only lasts for up to 30 minutes after you post to fix typos, etc. Please PM the code change to myself or any software dev moderator and we'll fix it for you. Or you can just post it in this thread if that's easier. However, if the highlighter screwed up the code, then it might be related to a bug, so I want to look into it ...

well it appears to add an extra \:

my $string = ' Mary had a little lamb. ';
$string =~ s/^\\s+//; #remove leading spaces
$string =~ s/\\s+$//; #remove trailing spaces
print $string;

should be (and it was)

my $string = ' Mary had a little lamb. ';
$string =~ s/^\s+//; #remove leading spaces
$string =~ s/\s+$//; #remove trailing spaces
print $string;

seems to be OK here though:

my $string = '  Mary had a little lamb.  ';
$string =~ s/^\s+//; #remove leading spaces
$string =~ s/\s+$//; #remove trailing spaces
print $string;

Fixed :) Let me know if I did it right.

Thanks csgal, your edits are correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.