Created
March 20, 2013 00:04
-
-
Save tomgidden/5201283 to your computer and use it in GitHub Desktop.
TrimPHP: removes whitespace from EOF, EOL, and pointless ?>'s from EOF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
while(<>) { | |
s/\s+$//s; | |
push @l,$_; | |
if(eof) { | |
($b=join("\n",@l))=~s/\s*(\?>)?\s*$/\n/s; | |
print $b; | |
undef @l; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment