in reply to url and arrays

You've got two mistakes in the posted code. From split
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;

Replies are listed 'Best First'.
Re^2: url and arrays
by perlaintdead (Scribe) on Jul 01, 2011 at 20:31 UTC

    TY. yours was the most helpfull