I am trying to remove all white spaces, tabs, newline, carriage return etc.. from a text file to make it as a one continous string. But the following code doesnot work. The file size is relatively smaller and hence I didn't use FILE::slurp. Please let me know the problem. Thanks.
Code:
#!/usr/bin/perl
local $/=undef;
open(FILE, "test.fa") || die ("Error\n");
$string = <FILE>;
$corrected_string =~ s/\n\r\t\s//g;
print "$corrected_string";
Comment