This is a newbie observation, but aren't you not supposed to name one of
your own variables with a number as the first value after a $, @, or % as in
the case of $2?  Could this be part of the problem?

Andrew

-----Original Message-----
From: Marcelo Taube [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 4:29 PM
To: [EMAIL PROTECTED]
Subject: Problem with regular expressions!!!


As u probably have guessed some part of my code is not working properly and 
i don't understand why!!

This is the code.
#####################################
$file_completename =~ /(.*?)\.(.*)/;
if ($2 eq $extension]) {
  #DO SOMETHING!!!
}
#####################################
As u see, i'm trying to separate the complete name of a file in two parts, 
the filename ($1) and the extension($2)... then i check to see whatever a 
extension is of some kind and if it is, i do something.
However this doesn't work. Because in $2, perl adds a "." before the 
extension.
4 example: if file_completename equal to "myfile.jpeg", then $2 equials to 
".jpeg", but it should be "jpeg".
What am i doing wrong?
Thank u very much,
Marcelo Taube



_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to