more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hiya,
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/\nfile1.txt\n fiel2.txt\n file3.txt\n after 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. Ta Arian In reply to Re^2: Simple Perl file rename
by Anonymous Monk
|
|