Reputation: 1359
I have a string that looks like this...
example.pdf"
I need to remove the whitespaces and linebreaks. How do I do this? My result should be
"http://www.example.com/example.pdf"
Upvotes: 6
Views: 26937
Reputation: 149736
Just use the s///
substitution operator:
$string =~ s/\s+//g;
The \s
character class matches a whitespace character, the set [\ \t\r\n\f]
and others.
Upvotes: 24