Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Perl (http://www.programmingforums.org/forum21.html)
-   -   got lazy writing C code...alas! a perl script for formatting (http://www.programmingforums.org/showthread.php?t=12578)

TheMuffenMann Feb 15th, 2007 1:43 AM

got lazy writing C code...alas! a perl script for formatting
 
well..usually i use hard tabs with a default width of 8, for writing C code, but recently i've adopted a 4 space indent width instead..there's no way in hell im gonna type 4 spaces for every level of indentation, so threw together a quick perl script (i'm actually quite new to perl as far as using it alot goes) so that i can be lazy and use hard tabs when coding, then run the source code through this script and have it indented right. anyways, here it is..it's quite small:

:


#!/usr/bin/perl

$^I = ".bak";

while (<>) {
    s/\t/    /g;
    print;
}


iradic Feb 15th, 2007 3:46 AM

IMHO it will not do what you want...


All times are GMT -5. The time now is 9:21 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC