test.txt:
0 1 2 3
test.pl:
#!/usr/bin/perl use strict; use warnings; open(FH, "<", "test.txt"); open(FH2, ">", "test2.txt" ); while(<FH>) { s/^(\s+)//g; print FH2 $_; } close FH2; close FH;
test2.pl:
#!/usr/bin/perl use strict; use warnings; open(FH, "<", "test.txt"); my @file = <FH>; close(FH); open(FH, ">", "test.txt" ); foreach (@file) { s/^(\s+)//g; print FH $_; } close FH;
I'm sure there are more ways to do this...
Update: man, I guess I was a little slow to type. When I started the reply, there was only the original node.
My thoughts are mine and mine alone.
They did not originate with the voices in my head.
Do not listen to what they say, it's all lies.
In reply to Re: Removing leading whitespace from a file?
by Mr. Muskrat
in thread Removing leading whitespace from a file?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |