Dave,
Try this :

my @files = <>;

@files = sort @files;
 foreach(@files){
    my $newname = $_;                     #### changed
 $newname =~ s/PIC1000/NEWNAME/;          #### changed 
rename($_, "$newname");

}

thanks,
Jay

-----Original Message-----
From: David Gilden [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 18, 2004 12:06 PM
To: [EMAIL PROTECTED]
Subject: basic syntax s/..../..../


Greetings,


I want to do the result of a substitution to $newname,
but do not have it correct.

#!/usr/bin/perl

# rename from the Terminal OSX

$orig = "tina-o1.jpg";

($orig = $newname)  =~ s/tina/quest/ig;

print $newname;
 
 __END__
 
 Then I would like to run from the command line the following:
 (OSX flie re-namer)
 
 my @files = <>;

@files = sort @files;
 foreach(@files){
    my $newname;
 ( $newname = $_)  =~ s/PIC1000/NEWNAME/; 
rename($_, "$newname");

}


Any suggestions would be appreciated,

Thanks,

Dave 

==============================================
         Cora Connection: Your West African Music Source
              Resources, Recordings, Instruments & More!
                   <http://www.coraconnection.com/> 
==============================================

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to