When I copy and paste your codeSince I provided 3 sets of code and output data, I am not sure which one you ran.
Let's try another approach...
> ls *.txt file1.txt file2.txt file3.txt > cat test.pl #!/usr/bin/env perl use strict; use warnings; use Data::Dumper; print Dumper(\@ARGV); > ./test.pl 's/foo/bar/' file*.txt $VAR1 = [ 's/foo/bar/', 'file1.txt', 'file2.txt', 'file3.txt' ]; >
My operating system in Linux. I have 3 *.txt files in my current directory. When I run my test.pl script, it simply prints out the contents of the @ARGV array, which correspond to the things which appear on the test.pl command line. The 1st thing on the command line is the string corresponding to the substitution operator. The 2nd thing on the command line is a file specifier using the standard Unix wildcard character (*), which gets expanded into 3 filenames.
Are you on a *nix OS, or are you on Windows, or a Mac?
Are you familiar with the concept of wildcard expansion?
In reply to Re^5: Simple Perl file rename
by toolic
in thread Simple Perl file rename
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |