in reply to Re: Simple Perl file rename
in thread Simple Perl file rename
I am trying to understand Larry's filename fixer. I saw it first in the cookbook and am now looking here to find help. I am new to Perl, but I think (I hope) I understand everything the script does. The only thing I don't get is how all the matching filenames end up in @ARGV. So if I call the rename script in a directory with three txt files like so:
rename 's/foo/bar/' *.txt
@ARGV would be an Array with four entries like this right?
s/foo/bar/\nafter the shift that removes the 's/foo/bar/' I am then left with the @ARGV that contains just the file names. The script then loops through all of them and works it's magic, so far so good.
What I do not understand is how the script determines which files to put into @ARGV. At which point is "*.txt" being evaluated? Or is it the shell that tells the script which files in the directory match the pattern *.txt?
This is probably a daft question but any help is much appreciated, as I said I am very new to this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Simple Perl file rename
by wnpaul (Initiate) on Aug 03, 2008 at 05:38 UTC | |
|
Re^3: Simple Perl file rename
by toolic (Bishop) on Jul 28, 2008 at 18:31 UTC | |
by Anonymous Monk on Jul 28, 2008 at 21:09 UTC | |
by toolic (Bishop) on Jul 29, 2008 at 02:05 UTC | |
by clearwater (Initiate) on Jul 29, 2008 at 09:41 UTC | |
by Anonymous Monk on Jul 28, 2008 at 21:12 UTC |