On Tuesday, June 25, 2002, at 11:44 AM, Erik Price wrote:
> I'm just starting learning Perl and I'm trying to write a simple Perl
> script that will change a file's name for me.
A helpful lister directed me to the "rename" function. From there it
was a piece of cake. Thank you to all who responded.
Erik
#!/usr/bin/perl -w
# hsnamerewrite.pl
# stupid script that changes the name of a file
use strict;
foreach my $file (@ARGV) {
if ($file =~ m!^([\w-]+\.php)\.noheadscript!) {
print "Changed $file to $1\n";
rename $file, $1;
}
}
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]