Hey all,

I seem to remember seeing this done somewhere, but now I can't figure out
how to do it now.

If you have a function that returns a list, such as split(), is there a way
to only return one item from that list, as if you were working with an
array?

For instance, if you have something like this:

    my $path = '/big/long/path/to/something.txt';

    my @dirs = split(/\//,$path);

    my $filename = $dirs[$#dirs];

Is there a way to eliminate the storing of each directory in @dirs, and just
assign $filename straight to the last item of what split() returns? I'm not
sure if it can be done, and if it can, I'm probably overlooking something
obvious... either way, I can't figure it out.

Thanks,
-- 
Michael


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to