http://qs321.pair.com?node_id=179796


in reply to replacing text file separators in regex

I would think, the following RE works with your case.

#Given that a comma separator is used between site and path
#$2 may or may not contain / or @ 

$url=~ /^(\w+):\/\/(.*),(.*)$/ ;


I assumed that your data looks like one of the following cases

ftp://XX/yyy:password@123.123.123.123,/
ftp://site,path
ftp://site,

For the "uninitailized value" warning use the defined fcn,

for example:
if (defined($site =~ /\@/)) { .. } else { .. }

-perlkid
  • Comment on Re: replacing text file separators in regex