"be consistent" | |
PerlMonks |
Re: replacing text file separators in regexby perlkid (Novice) |
on Jul 06, 2002 at 04:31 UTC ( [id://179796]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|