Link to home
Start Free TrialLog in
Avatar of Tolgar
Tolgar

asked on

how to remove new line and all white spaces in one line of command in Perl?

Hi,

How can combine the following two commands in one line?

$text=~s/\n//g; 
$text=~s/\s+//g;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tolgar
Tolgar

ASKER

I think there is a syntax error in here. Can you please double check?

Thanks,
Yes, sorry.

Please test this and let me know ASAP
$text=~s/\n|\s+//g;