in reply to Replace only tab space with commas
Perhaps in my sleep deprived state I'm overlooking something, but I believe that following work:
use strict; use warnings; my $text = "I love\tmy nation."; $text =~ s/\t/,/g; print "$text";
Output: I love,my nation.
However, if those are actually 8 spaces instead of an actual tab, the regex in my code won't work. In that case, you'd probably want to do something along the lines of what Nikhil Jain posted.
|
|---|