split /PATTERN/,EXPR,LIMIT
split /PATTERN/,EXPR
split /PATTERN/
split
So you mean @parse = split("/", $url); not @parse = split($url, "/");. As well, array indexing starts from 0, not 1, so @parse[$parse]; is out-of-bounds -- see Variable names. You can fix this either with $parse = $#parse; or $parse = @parse - 1;.
Corrected version:
$url = "http://www.bing.com/default.aspx"; @parse = split "/", $url; $parse = @parse-1; $FileName = @parse[$parse]; print $FileName;
In reply to Re: url and arrays
by kennethk
in thread url and arrays
by perlaintdead
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |