I've included the fixes below.

But basically when you refer to $date{index}

you are really talking about the hashkey 'index' of hash '%date'.
So at the beginning you should declare your hashes, you declared them as
strings.
e.g.

my %date; # this is a hash
not
my $date; #  this is a string



#%date=('index'=>'split text from your @lines array');



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Craig Sharp
> Sent: Tuesday 05 March 2002 16:32
> To: [EMAIL PROTECTED]
> Subject: [Perl-unix-users] strict help needed !!!!
>
>
> I am having a problem with the following script:
>
> #!/usr/bin/perl -w
>
> use strict;
> use Spreadsheet::WriteExcel;
>
> my $workbook  = Spreadsheet::WriteExcel->new("unixsvrs.xls");
> my $worksheet = $workbook->addworksheet();
>
> my @date;
> my @time;
> my @device;
> my @address;
> my @count;
> my $index;
 my %data;
 my %date;
 my %time;
 my %device;
 my %address;
 my %count;
>
> open (INFILE, "unixsvrs.txt.log") || die "$!";
>
> my @lines = <INFILE>;
>
> $index = 0;
>
> foreach $data (@lines) {
>
   foreach my $data(@lines) {
>
> ($date{index},$time{index},$device{index},$address{index},$count{index}) =
split /\|/,$data;
>
printf("%s\t%s\t%s\t%s\t%s\n",$date{index},$time{index},$device{index},$addr
ess{index},$count{index});
>
>         $index++;
> }
>
> It gives me the following error:
>
> Global symbol "%date" requires explicit package name at
> make_sheet.pl line 30.
> Global symbol "%time" requires explicit package name at
> make_sheet.pl line 30.
> Global symbol "%device" requires explicit package name at
> make_sheet.pl line 30.
> Global symbol "%address" requires explicit package name at
> make_sheet.pl line 30.
> Global symbol "%count" requires explicit package name at
> make_sheet.pl line 30.
> Global symbol "%date" requires explicit package name at
> make_sheet.pl line 32.
> Global symbol "%time" requires explicit package name at
> make_sheet.pl line 32.
> Global symbol "%device" requires explicit package name at
> make_sheet.pl line 32.
> Global symbol "%address" requires explicit package name at
> make_sheet.pl line 32.
> Global symbol "%count" requires explicit package name at
> make_sheet.pl line 32.
> Execution of make_sheet.pl aborted due to compilation errors.
>
> If I put my in front of the $date{index}, $time{index}, etc... it
> tells me that I have a syntax error in the printf near the
> $time{index} entry.
>
> I am lost.
>
> Thanks,
>
> Craig
>
> _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to