|We don't bite newbies here... much|
[Solved] Generate list from a to arbitrary letterby three18ti (Scribe)
|on Nov 20, 2013 at 22:50 UTC||Need Help??|
three18ti has asked for the
wisdom of the Perl Monks concerning the following question:
I am generating disk names and need to generate a list from a to X, where X is anything from z to zz.
At the moment, I'm generating a list then taking an array slice, e.g.:
The problem is, what if I need to go to "aaa", e.g. @disk_list is 703 long, this won't allow for that, and I think will generate an error, since @list[ 0 .. 703 ] would be out of bounds.
How can I generate a list from a to an arbitrary upper limit?
Acutually, the full sub is:
Edit: ok, a slice with an out of bound index would just return an empty value, which is even worse than generating an error
Solved Edit: Thanks very much everyone. I think I can make one of these solutions work.