0

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?

2
Contributors
7
Replies
8
Views
10 Years
Discussion Span
Last Post by KevinADC
0

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 ...

0

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;

0

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;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.