bluetooth has asked for the wisdom of the Perl Monks concerning the following question:
hi, i have written a small script which searches for .c or .h file in a folder and searches for "tab space" and sustitute with 4 spaces, it din't work. can u tell where am i going wrong.?
$tu ="D:\\PERL\\crc_test\\shock_api.h"; print "match:$&\n" if $res=$tu=~ m/\.c$/ ; print "match:$&\n" if $mes=$tu=~ m/\.h$/ ; if ($mes=$tu=~ m/\.h$/ or $res=$tu=~ m/\.c$/) { open FH, $tu or die "cannot open the required file :$!\n"; while ( my $line = <FH>) { $line =~ s/\\t/ /g; } close (FH) or die "cannnot close the required file:$!\n"; } else { print "out of loop\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: substitute 4 spaces instead of a tab
by anneli (Pilgrim) on Nov 07, 2011 at 09:05 UTC | |
by anneli (Pilgrim) on Nov 07, 2011 at 10:40 UTC | |
by davido (Cardinal) on Nov 07, 2011 at 16:53 UTC | |
by JavaFan (Canon) on Nov 07, 2011 at 16:27 UTC | |
|
Re: substitute 4 spaces instead of a tab
by Ratazong (Monsignor) on Nov 07, 2011 at 09:04 UTC | |
|
Re: substitute 4 spaces instead of a tab
by toolic (Bishop) on Nov 07, 2011 at 13:50 UTC | |
|
Re: substitute 4 spaces instead of a tab
by Anonymous Monk on Nov 07, 2011 at 09:12 UTC |