A couple more pointers for you:

First, use POSIX::strftime to format your time stamp:
use POSIX; my $date_for_logfile = strftime( "%e %B %C%y, %T", localtime);
If you still insist that the month is all lower case, then you could always use lc.

$date_for_logfile is rediculously long, how about just $log_date instead? or $ts for timestamp? By the way, did you know that you can get a very nice generic timestamp by simply using:

my $ts = scalar localtime;
Unless i need a very specific format for my time stamp, that is exactly what i use. POSIX::strftime() takes care of the rest. ;)


Second item is your check_ip sub. One important lesson i have learned over the years is that unless the sub contains the word print, it should not print. Also, don't use global variables like that, not when you can pass them in:
my $ip = '127.0.0.1'; print ip_error() unless check_ip($ENV{REMOTE_ADDR},$ip);
Now, check_ip will look like:
sub check_ip { my ($ip1,$ip2) = @_; return $ip1 eq $ip2; }
and our new sub, ip_error() will return (not print) the HTML to be used for our error. I will use CGI.pm to output the HTML, you should too:
sub ip_error { return header, start_html( -title => 'Error', -style => { -code => q|body { font-family: "Verdana, Arial"; text-alig +n: center; color: red }|, }, ), b('Invalid ip-number'), ; }
Of course, now check_ip seems a bit overkill, so maybe we could instead use:
print ip_error() unless $ENV{REMOTE_ADDR} eq $ip;
I think there is nothing wrong with hacking out some code, but before i share it with others, i refactor out the nonesense.

Hope this helps, on the whole your script is nice, but you really should have cleaned it up a bit before you posted. As well as using strict and warnings, good indentation is a must, and until you develop your own style of 'proper' indentation, run your code through perltidy first. Here is a clue that you are not indenting properly: when you see two ending braces lined up with each other on two or more consecutive lines:

} }
Happy coding to you! ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to (jeffa) Re: Quick 'n very dirty flash-variables updatescript by jeffa
in thread Quick 'n very dirty flash-variables updatescript by teabag

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.