# Pull out the numbers of the checkboxes that were selected. # e.g. If box1, box3 and box12 were selected, @selected = (1, 3, 12) my @selected = grep { $_=$1 if /^box(\d+)/; } $q->params(); open FH, $filename or die "Can't read $filename, $!"; # open for read my @posts = ; # This should delete the post text associated with each selected checkbox # You have to use the @selected array in reverse. I leave the # explanation for this as an exercise for you. :) splice @posts, ($_ - 1), 1 for reverse @selected; # Now write the file back out again open FH, ">$filename" or die "Can't write to $filename, $!"; print FH @posts or die "Couldn't write to file, $!"; close FH or die "Can't close file etc, $!";