I need a help with my code...
What I want to do is:
if there exists a directory_no, and found in the directories array , want to copy the contents of that array to a new array from where the directory_no is found to till the end of that array.
In the end copy the new_directory array to the directories array;
Ex:directories array: 1 2 3 4 5
directory_no is 3.
Output :new_directory 3 4 5
in the end directories array: 3 4 5
@directories=@n ew_directory;
What I want to do is:
if there exists a directory_no, and found in the directories array , want to copy the contents of that array to a new array from where the directory_no is found to till the end of that array.
In the end copy the new_directory array to the directories array;
Ex:directories array: 1 2 3 4 5
directory_no is 3.
Output :new_directory 3 4 5
in the end directories array: 3 4 5
Code:
if($directory_no) { foreach $directory (@directories) { $count++; print "$count"; if($directory = $directory_no) { for($count;$count<=@directories;$count++) { $new_directory[i]=$directories[$count-1]; $i++; } exit; } } }
Comment