|
1. open(OUT,'>','outfile'); #???? can u please tell me wats happening here
2. print OUT @array[4..$#array-2]; #???? and here toooo
3. close OUT; #?????
1. opens a new file for writing or opens an existing file for overwriting. Associates it with filehandle OUT.
2. prints the array minus the first 4 and last 2 elements to filehandle OUT, which in this case means the lines of the file. This is called an array slice: @array[n,n...n]. It would be the same as doing this:
shift @array;
shift @array;
shift @array
shift @array;
pop @array;
pop @array;
but the array slice will be much faster for what you are doing because it does not modify the array.
3. closes the file associated with IN filehandle.
|