![]() |
|
XP is just a number | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
I occasionally like to remove whole-line comments from config files or Perl scripts (esp. when the comments prevent me from seeing the code clearly). This works great:
Remove the (\s*) if your definition of "whole-line comment" doesn't include whitespace before the '#'. Also note that I deliberately avoid in-place edit, as the point is to make a clean copy. On Windows, I often like to backup generated files before doing a second test run. Since I want to compare both sets of output, sometimes I need to leave the extension intact: works smashingly (specifically for XLS files, that one). And finally, also on Windows (where find means something different than on UNIX), I sometimes want to remove all files in a directory (not the whole tree) that are more than 48 hours old: Update: And to search the whole tree:
Yoda would agree with Perl design: there is no try{} In reply to Re: Favourite One-liners?
by radiantmatrix
|
|