many thanks for the assistance

here is the program in full so you may verify i did it correctly (i'm sure there was a 
shorter way, but right now i'm just trying to get the darn thing to work!!!)  But now 
an error of an uninitialize value in 46 &51 occurs and I don't know what to do..please 
assist? I marked them with a comment like this "#######  use of uninitialize value". 
Also an error "Arguement "" isn't numeric in eq at line 58" also marked as above.


#!/usr/bin/perl -w
use strict;

my $homepage;
my $counterfile;
my %imagefile;
my @querys;
my $query;
my $name;
my $value;
my %form;
my %FORM;
my $position;
my $number;
my $positionnumber;
my $imagereturn;
####################################
# Setup begin

#$homepage = "/home/thx-1138";
$homepage = "c:/internet/homepage.0";

$counterfile = "$homepage/counter.txt"; #Full file path of counter.txt


#for
# (my $i = 0; 
# $i <= 9; 
# $i++)
# {$imagefile{i} = $homepage."/".$i.".gif";}


$imagefile{'0'}="$homepage/0.gif"; #Full file path of 0.gif
$imagefile{'1'}="$homepage/1.gif"; #Full file path of 1.gif
$imagefile{'2'}="$homepage/2.gif"; #Full file path of 2.gif
$imagefile{'3'}="$homepage/3.gif"; #Full file path of 3.gif
$imagefile{'4'}="$homepage/4.gif"; #Full file path of 4.gif
$imagefile{'5'}="$homepage/5.gif"; #Full file path of 5.gif
$imagefile{'6'}="$homepage/6.gif"; #Full file path of 6.gif
$imagefile{'7'}="$homepage/7.gif"; #Full file path of 7.gif
$imagefile{'8'}="$homepage/8.gif"; #Full file path of 8.gif
$imagefile{'9'}="$homepage/9.gif"; #Full file path of 9.gif
#Setup end
############################
$|=1;
@querys = split(/&/, $ENV{'QUERY_STRING'});  "#######  use of uninitialize value"
foreach $query (@querys) {
   ($name, $value) = split(/=/, $query);
   $FORM{$name} = $value;     
}
$position="$FORM{'position'}";  "#######  use of uninitialize value"

open(NUMBER,"$counterfile");
$number=<NUMBER>;
close(NUMBER);

$number++;
if ($position==1) {  #########"Arguement "" isn't numeric in eq at line 58"
   open(NUMBER,">$counterfile");
   print NUMBER "$number";
   close(NUMBER);
}

if (($position>0) && ($position<=length($number))) {
   $positionnumber=substr($number,(length($number)-$position),1);
}
else {
   $positionnumber="0";
}
if ($imagefile{$positionnumber}) {
   $imagereturn=$imagefile{$positionnumber};
}
else {
   $imagereturn=$imagefile{'0'};
}

print "Content-type: image/gif\n\n";

open(IMAGE,"<$imagereturn");
print <IMAGE>;
close(IMAGE);
exit 0;

  ----- Original Message ----- 
  From: Hasanuddin Tamir 
  To: Luinrandir Hernson 
  Cc: [EMAIL PROTECTED] 
  Sent: Monday, June 04, 2001 10:36 PM
  Subject: Re: newcounter(was did i do that correctly)


  On Mon, 4 Jun 2001, Luinrandir Hernson <[EMAIL PROTECTED]> wrote,

  > what does:
  > global symbol requires explicit package name
  > mean?
  >
  > blast! the
  > use strict;
  > is causing that problem but i don't know how to do what it wants

  No!  It doesn't cause the problem.  It *tells* you what causes the
  problem.  Don't panic.  The error also tells you what global symbol
  that requires explicit package name and the line number.  The only
  thing you need to do is declaring the variable in question with my()
  operator.

      my $what_is_the_variable_name_anyway;

  Each variable must have explicit scope.  All variables are global by
  default, but you can make it lexically scope by declaring using my().
  Please read the docs,

      perldoc -f my
      perldoc perlsub

  When you use strict however, you have to explicitly specify whether
  a variable is,

  * in global scope by using a package name,

      $main::variable_name = 'some value';
      use vars qw($variable_name); # another way to declare global variable

  * or in lexical scope by using my() operator as above,

      my $variable_name;


  hth
  s.a.n
  -- 
  Hasanuddin Tamir: [EMAIL PROTECTED] - Trabas: www.trabas.com


Reply via email to