Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Use of uninitialized value in string eq

by maxcross7 (Initiate)
on Sep 05, 2008 at 03:13 UTC ( #709172=note: print w/replies, xml ) Need Help??

in reply to Re: Use of uninitialized value in string eq
in thread Use of uninitialized value in string eq

Thank you for your quick response.
Being a novice, I am not sure how to implement your responses.

Where in the code should I insert this? Here is the code (required fields are normally populated):

# This is the multicounter stats file $cntfile = ""; # To turn on logging $log = 1 else $log = 0 $log = 1; # If you want the counter output printed on your page $scrprint = 1 el +se 0 $scrprint = 1; # Location of your log file $logfile = ""; # Your own ip-address $own = ""; # -------------- Start program ----------------------------------- print "Content-type: text/html\n\n"; $date = localtime(time); open(INF,"$cntfile") || die "Can't open $cntfile to read: $! \n"; seek(INF,0,0); @data = <INF>; foreach $i (@data) { ($sitename,$counter,$ip_address) = split(/=/,$i); chop $ip_address; $sitename =~ s/ //g; $counter =~ s/ //g; $ip_address =~ s/ //g; $visitor = $ip_address; if ($sitename eq $ENV{'id'} && ($visitor eq $ENV{'REMOTE_ADDR'}) || ($ +own eq $ENV{'REMOTE_ADDR'})) { print $counter if ($scrprint eq "1"); exit; } else { if ($sitename eq $ENV{'id'}) { $counter++;<br> print $counter if ($scrprint eq "1"); open(ART,"$cntfile") || die "Can't open $cntfile to read: $! \n"; @data = <ART>; close(ART); open(ART,">$cntfile") || die "Can't open $cntfile to write: $! \n"; foreach $line (@data) { flock(ART,2); $line =~ s/$ENV{'id'} = [0-9]+ = [0-9]+.[0-9]+.[0-9]+.[0-9]+/$ENV{'id' +} = $counter = $ENV{'REMOTE_ADDR'}/g; print ART $line; } close(ART); if ($log eq "1") { open(OUTF,">>$logfile") || die "Can't open $logfile to write: $! \n"; print OUTF "$date | $ENV{'id'} | $counter | $ENV{'REMOTE_ADDR'} | $ENV +{'HTTP_REFERER'}\n"; close(OUTF); } } } }

Replies are listed 'Best First'.
Re^3: Use of uninitialized value in string eq
by NetWallah (Canon) on Sep 05, 2008 at 04:35 UTC
    • Please use <CODE> tags. Instructions are in Writeup Formatting Tips
    • The diagnostic/error checking code for $sitename should be placed immediately after $sitename receives a value, via the "split" function.
    • $sitename receives its value from the INF ($cntfile) file. Looking at the contents of that file should help show what it would contain.
    • You should also check your $logfile -e it should contain the contents of $ENV{'id'}.

         Have you been high today? I see the nuns are gay! My brother yelled to me...I love you inside Ed - Benny Lava, by Buffalax

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://709172]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-10-01 14:39 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (126 votes). Check out past polls.