if (defined $lines[$number1 - 1]) { print $lines[$number1 - 1]; print "\n"; } else { print "No link at that index\n"; }
This will check if there's a value at the spot in the array. This will benefit you if, in the future, you expand your code to delete links, or if you accidentally have blank lines in your input file.
As always, TMTOWTDI.
In reply to Re: Re: Re: Initialize array
by aijin
in thread Initialize array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |