PDA

View Full Version : How do I use the / as a Delimiter in the split function?


buckroe2
02-26-2007, 12:21 AM
How do I use the / as a Delimiter in the split function?
since the / is used as a start and end of the delimiter field.

This is the code now:
($url1, $url2, $url3) = split (/\./,$Image_Upload_4);


This is what I want to be able to split up the url:
($url1, $url2, $url3) = split (/\/./,$Image_Upload_4);


I have tried to put the / in quotes but that did'nt work.

Thanks for any help.

rwedge
02-26-2007, 01:15 AM
to split on /
split(/\//, $Image_Upload_4);

to split on \
split(/\\/, $Image_Upload_4);


if you are trying to get just the file name :
for /
$Image_Upload_4 =~ s/^.*\///g;

for \
$Image_Upload_4 =~ s/^.*\\//g;