I have created a list from which I can "pop" out certain values one by one on down the list and insert the popped value into a subroutine in a continuously looping while statement.
Problem is that if a user logs or the script is interrupted I have no way to tell the script how to pick up where it left off.
I am using the following to take the output of the list and place it in an ASCII text file on my system each time the while loop recyles immediately before the subroutine is kicked off again...
open (UPDATE, "> $file_path_variable");
print UPDATE "@cd_list";
close (UPDATE);
This continuously updates the file defined by $file_path_variable with the new elements of the list minus the element which was just popped of course.
This made sense to me I thought I was really on to something great here :) Of course it didn't work out this way :(
If I were to print the @cd_list before that operation it shows all of the values of the list seperated by spaces. If I go to the file which was opened and updated after that bit of code is executed it shows all of the elemets of the list WITHOUT spaces between them.
Now you see my dilemna...When I try to kick off the script again with a different subroutine I use the following line to define the NEW list before kicking off the subroutine again.
@continue_cd_list='more $file_path_variable';
Of course the "more" results in one very large value of list elements that are not seperated by spaces instead of individual elements.
I know there is an easier way to do this, I am new to PERL scripting and any help that can be provided would be appreciated. Perhaps I am going about this all wrong.
Thanks in advance.