The stupid question is the question not asked | |
PerlMonks |
File::Find and replacing spaces in filenames.by Kyshtynbai (Sexton) |
on Dec 22, 2012 at 16:56 UTC ( [id://1010031]=perlquestion: print w/replies, xml ) | Need Help?? |
Kyshtynbai has asked for the wisdom of the Perl Monks concerning the following question: Hi everyone! I have to process a lot of filenames and directory names which may contain spaces: I want to change spaces with, lets say, _ symbol. I've googled for a solution; and I've found a rather ugly Bash string which however works fine. I've decided to write a much more good-looking Perl script which would do the same thing. But the only code I was able to compose is the following code:
I've run it; first time I've run it, it returned an error like this:
But it had processed all the filenames and changed spaces with _. I've run the script second time and it didn't return any mistake and all of my filenames and dirnames were processed. My question is: what have I done wrong and how to improve this script? I'm a newbe in Perl and, to tell the truth, in Unix, so please don't blame me too hard :) . Thank you in advance.
Back to
Seekers of Perl Wisdom
|
|