Clear questions and runnable code
get the best and fastest answer
How to make code smaller--saving steps and writing one linersby Petras (Friar)
|on May 09, 2009 at 02:01 UTC||Need Help??|
Petras has asked for the
wisdom of the Perl Monks concerning the following question:
Hello! I wrote something recently, and then had to go through it and actually seperate things into a few lines to get it to work (not that I did it right the first time...) It's a simple code to make a list of files dropping out the first few levels of file paths. The code in question is here:
If you can't tell just by looking at it that I'm running Windows, you probably can't help me here :~)
It's Strawberry Perl 5.8
I recall reading once that someone wrote a web spider in one line...I'm not really good at one liners. Is there a way to squish
into two or even one lines? And does anyone know a good place to start looking for something like a brevity tutorial? I recently watched a podcast where the speaker said, "If statements are obsolete if you know how to use the space-ship operator!" I'm not so much looking to obfuscate, but I'd like to save a few keystrokes.
Thanks and Cheers!
ctrl+2 load "zork",8,1
West of House