in reply to Replace multiple tabs with spaces at start of a string
#!/usr/bin/perl # http://perlmonks.org/?node_id=1190410 use strict; use warnings; my $input = <<END; | | | | | | | | ! ! first line \t\tsecond line \t\t\tthird line \tfourth line \t\tfifth line \t\tline with\t\tin the middle last line END open my $fh, '<', \$input or die "$! opening file"; while(<$fh>) { s/\G\t/ /g; print; }
|
|---|