in reply to Re^5: Use Of Glob On File Extensions (find/rule)
in thread Use Of Glob On File Extensions
I figured it out! I was just being stubborn with glob. I had to read up on the tutorial involving the File::Find for a while until I understood what was going on. This is what I came up with.
#!/usr/local/bin/perl use strict; use warnings; use File::Find; my @argv; my $dir = $ARGV[0]; find(\&dirRecurs, $dir); sub dirRecurs{ if (-f) { (my $txt = $_) =~ s/pl$/txt/; rename($_, $txt); } if (-d) { (my $txt = $_) =~ s/pl$/txt/; rename($_, $txt); } }
Thank you for helping me out Anonymous Monk, it is greatly appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Use Of Glob On File Extensions (find/rule)
by NewToPerl777 (Novice) on Nov 19, 2014 at 02:59 UTC |