Dear Anonymous Monk,
You have restored my belife, that all programers have a unique sense of humour.
Thank you all for everything in the past.
I actually pulled the counter script apart and inserted the following on the end of Script1.
$filename = 'hits.data'; $main_dir = 'C:/Apache2/cgi-bin/sample'; $autoadd=1; $view_log='***********'; &FormInput(*input); $addnew=0; $lock = "$main_dir/count_lock.lock"; if ($input{'view'} ne $view_log) { &SetLock; } open(DATA,"$main_dir/$filename"); @lines = <DATA>; close(DATA); if ($input{'view'} eq $view_log) { } else { open(DATA,">$main_dir/$filename"); foreach $line (@lines) { ($link_url, $link_count1) = split(/\|/,$line); if ($input{'url'} eq $link_url1) { $link_count1++; print DATA ("From the Sample script.|$link_count1\n"); $addnew=1; } else { print DATA $line; } } if ($addnew == 0 && $autoadd == 1) { print DATA ("$input{'url'}|1\n"); } &EndLock; close(DATA); if ($input{'url'} !~ m?://?) { $input{'url'} = "http://" . $input{'url'}; } } exit; sub FormInput { local (*qs) = @_ if @_; if ($ENV{'REQUEST_METHOD'} eq "GET") { $qs = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$qs,$ENV{'CONTENT_LENGTH'}); } @qs = split(/&/,$qs); foreach $i (0 .. $#qs) { $qs[$i] =~ s/\+/ /g; $qs[$i] =~ s/%(..)/pack("c",hex($1))/ge; ($name,$value) = split(/=/,$qs[$i],2); if($qs{$name} ne "") { $qs{$name} = "$qs{$name}:$value"; } else { $qs{$name} = $value; } } return 1; } sub SetLock { $timecheck = 0; while(-e $lock) { sleep(5); $timecheck = $timecheck + 1; if ($timecheck >= 5) { unlink("$lock"); } } open(LOCKFILE,">$lock"); close(LOCKFILE); return; } sub EndLock { unlink("$lock"); return; }

there would be much more left there than I really need .
But it workes wonderfully fine .
So I am happy.
Nasa.

In reply to Re: Re: Calling two scripts. by nasa
in thread Calling two scripts. by nasa

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.