Thanks for the general tips, I apologise for the delay in replying - I have been trying to synthesise the salient parts or the script

In fact I have isolated what is causing the problem, but I'm not sure why or how I should change things to do what I want.
The background is that several scripts are accessed by a single user by way of a 'work page', containing buttons for those scripts.
When a script is finished with it uses wslib ( soon to be WSLib(!! :) ) to create a new work page, using html::template (not shown to keep the example simple.
In this particular instance the script edits the text file $data_reg called up in sub workspace, and renames it. If I comment out the rename line, sub workspace prints out the whole file, if I leave it in it only prints three quarters of it!! How should I deal with this?

sub edit { my $newline = join "\t", ($count_in,$current_time_in,$user_in,$passwo +rd_in,$email_in,$web_in,$agencyname_in,$business_in,$country_code_in, +$mobile_no_in,$sec_email_in,$skip); open FH, "$data_reg" or die "Can't open data_reg file for reading: $! +"; flock (FH, 1) or die "Can't lock data_reg file for reading"; my @alldata = <FH>; close FH; open FILE, '>', "$data_reg.tmp" or die "Can't open data_reg file for +reading: $!"; flock (FILE, 2) or die "Can't lock data_reg.tmp file for writing"; foreach (@alldata) { chomp; ($count,$current_time,$username,$password,$email,$web,$agencyname, +$business,$country_code,$mobile_no,$sec_email,$skip) = split /\t/; if ($user_in eq $username) { print FILE "$newline\n"; } else { print FILE "$_\n"; } } # rename ("$data_reg.tmp", "$data_reg") or die "Can't rename file: $! +"; ##only prints properly if commented out! &workspace(@exp); }

In reply to Re^2: data leak using package by Anonymous Monk
in thread data leak using package by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.