codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Cant use an undefined value as a Symbol reference at compare1.pl line 66  night_scorpion at 06:51 on Thursday, September 07, 2006
 

Hello ,

i have this program for which i do not know yet where exactly the problem is . i guess it is something to do in defining a variable or maybe with my arguments which are defined maybe in a proper manner . would be gratefull for any advice

compare1.pl

#!/usr/bin/perl
use strict;
use warnings;

# initialise
my %diff ;
my %diff1 ;
my %diff2 ;

my ($filename1, $filename2) = @ARGV;

@ARGV=2 or die "Usage : There should be 2 arguments";

open my $txt1,"< $filename1" or die "cant open '$filename1' for reading $!";
open my $txt2,"< $filename2" or die "Cant open '$filename2' for reading $!";
open my $txt3,"/forum/gt_added.txt" or die "cant open added.txt for reading $!";
open my $txt4,"/forum/gt_deleted.txt"or die "Cant open deleted.txt for reading $!";
open my $txt5,"/forum/gt_common.txt" or die "cant open common.txt for reading $!";



# create a hash table
while (<$txt2>)
{
$diff{strip($_)} = 1;
}

# extract added/deleted values

while(<$txt1>)
{
print $txt3 $_ unless (check_content($_) || !(eliminate(strip($_))));
}

close $txt1;
close $txt2;
close $txt3;

................................................................
test.pl

#!/usr/bin/perl
use strict;
use warnings;

system("/home/compare1.html","/home/update_0609041028.txt","/home/update_0609041042.txt");


Note :i have eliminated the subroutines.

  Re: Cant use an undefined value as a Symbol reference at compare1.pl line 66  night_scorpion at 07:35 on Thursday, September 07, 2006
 

Edit : I forgot to specify line 66

open my $txt1,"< $filename1" or die "cant open $filename1 for reading $!"

  Re: Cant use an undefined value as a Symbol reference at compare1.pl line 66  S_Flex at 13:05 on Thursday, September 07, 2006
 

I dont see a line 66 in this code.
your getting that error becase the code is using strict;. Not a big deal, I personaly like to use strict and warn. Once all the bugs are worked out the code will run faster.

if your having some problems with undefined value in the code using "use var qw( );" can help. Adding the veriables in var is just like doing this "my %diff1;".

#!/usr/bin/perl
use strict;
# initialise global variables.
use vars qw(
$txt1 $txt2 $txt3 $txt4 $txt5
%diff %diff1 %diff2
);
use warnings;

my ($filename1, $filename2) = @ARGV;

@ARGV=2 or die "Usage : There should be 2 arguments";

open $txt1,"< $filename1" or die "cant open '$filename1' for reading $!";
open $txt2,"< $filename2" or die "Cant open '$filename2' for reading $!";
open $txt3,"/forum/gt_added.txt" or die "cant open added.txt for reading $!";
open $txt4,"/forum/gt_deleted.txt"or die "Cant open deleted.txt for reading $!";
open $txt5,"/forum/gt_common.txt" or die "cant open common.txt for reading $!";

est.........

Hope that helps,
Flex








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  help
•  Re: Problem with concatenation
•  reg column sorting for long type..
•  Random Images In An ASP.NET Web Page
•  How to support Unicode for Embeded Perl
•  Ms word to be opened using javascript
•  Re: research the search - hash
•  Re: Multiple words in regexp
•  Re: How to open a MS Word document from Javascript


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007