in reply to split file at line number
split -l 500 file.txt [download]
If you want to use perl, you can make use of the special variable (INPUT_LINE_NUMBER): $.