hclements
asked on
string parsing in perl
I don't know perl at all but I need to parse a string and remove the white spaces out of it. How do I do it?
Say I have "UNIX OS/2 Windows MAC"
and I want to make it "UNIXOS/2WindowsMAC"
how do I do it? Thanks.
Say I have "UNIX OS/2 Windows MAC"
and I want to make it "UNIXOS/2WindowsMAC"
how do I do it? Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did that work?
($new_string = $string) =~ s/\s//g;
This copies $string to $new_string and then does the substitution on $new_string, preserving $string.