Clean up formatting of a perl script

perltidy foo.pl
By default, perltidy will create a file with the extension '.tdy'.

0
By: bartonski
2010-07-19 11:51:47

These Might Interest You

  • This will create a new file with proper code formatting and all comments removed.


    0
    perl -MO=Deparse filename.pl | perltidy > new.pl
    kimmel · 2011-11-16 18:54:30 0
  • the command show can be run in vim, here is the same thing on the command line cat script.pl | perl -MO=Deparse | perltidy


    3
    %! perl -MO=Deparse | perltidy
    syssyphus · 2009-09-24 03:32:04 0
  • This one line Perl script will display the smallest to the largest files sizes in all directories on a server. Show Sample Output


    1
    du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}' | more
    Q_Element · 2012-02-07 15:49:19 0
  • this command is used to locate all pom.xml files, access the dir and do a mvn clean, but I do recommend you to disable network interfaces to not download dependencies packages to be faster. Show Sample Output


    -2
    find -name pom.xml | while read f; do cd $(dirname "$f"); mvn clean; cd -; done;
    glaudiston · 2015-04-15 21:24:49 1

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: