Hello,
      I am not sure, why you want to 'do Nothing' about the contents of the file.  if 
you change gif to jpg, it will conflict the formats.

      Try this for just changing names: 

$a='1.x.jpg'; # first file..
$b='3.gif';   # second file..
if ( "$a:$b" =~ /(.*)\.([^\.]+):(.*)\.([^\.]+)/)
{
$a="$3.$2";
$b="$1.$4";
}
print " a = $a ;; b= $b \n";

thanks,
Jay

-----Original Message-----
From: Bajaria, Praful [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 13, 2004 2:53 PM
To: [EMAIL PROTECTED]
Subject: New to perl ...


Hello,

I would like to swap the file name only and not the extension or the
content. 

Example:
There are two file : 1.jpg and 3.jpg 
output = 1.jpg becomes 3.jpg and 3.jpg becomes 1.jpg

OR

1.jpg and 3.gif
output  = 1.jpg becomes 3.jpg and 3.gif becomes 1.gif
here we are changing the name only and not the extension.

Inside my program I don't know either files extension, but they will be only
"jpg or gif"

Any help...


--
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