Your first code will take a new line from the end of $ myString, if it exists, then remove all the "/" characters. The second line of code will remove all whitespace characters. Is there a typo?
You might want to know that you can replace this:
chomp($myString);
$myString =~ s/\s//g;
with this:
$myString =~ s/\s//g;
If this is a question, then yes. Since the newline character is considered a space, the second code example does the work of both lines above.
source
share