A brief explanation of what I am trying to do is copy all the information between programlisting and /programlisting to a new outputfile.

I have the following script that I think should do this for me but it seems not to work and I was wondering if somebody could tell me where I am going wrong with it and hopefully point me in the right direction. I have also enclosed a copy of my test input file incase this comes in handy.

usestrict; use diagnostics; use CGI(); use CGI::Carp qw(fatalsToBrowser); use Fcntl qw(:flock);

my $query = new CGI; my $file = $query -> param('file');

open (TXT, $file) or die "Can't open $file: $!"; flock(TXT, LOCK_SH); # no one can edit the file now.my @text = <TXT>;

I didn't have the time to see the $file contents, and the only thing I noticed by looking at the code is that there is a $codesends variable instead of $codeends in one place (you're using strict, so you must've noticed the probem).

Just a note: You could replace push @alllines, $_ while(<TXT>); with @alllines = <TXT>;