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:
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
Thanks and Cheers!
~Petras
Ready.
poke 53280,0
poke 53281,0
ctrl+2 load "zork",8,1
West of House
If you can't tell just by looking at it that I'm running Windows, you probably can't help me here :~)use File::Find; open (OUT, ">filelist.txt"); find( sub { $temp = $File::Find::name; $temp =~ s/C:\/users\/User\/Music\/(.*)/$1/gi; print OUT "$temp\n"; }, "C:/users/User/Music/"); close OUT;
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.$temp = $File::Find::name; $temp =~ s/C:\/users\/User\/Music\/(.*)/$1/gi; print OUT "$temp\n";
Thanks and Cheers!
~Petras
Ready.
poke 53280,0
poke 53281,0
ctrl+2 load "zork",8,1
West of House
|
---|
Back to
Seekers of Perl Wisdom