Hi Gurus,
I have written a package as below. __________________PACKAGE package parseSite; use strict; use warnings; sub new { my $class = shift; my $Input_file=shift; bless {InputFile=>$Input_file},$class; } sub Print_file { my ($self,$Category,$course_name,$Instructor,$videos)[EMAIL PROTECTED]; print "$self\n"; print "$Category\n"; print "$course_name\n"; print "$Instructor\n"; print"$videos\n"; } sub GET_Values { my $Rows; my $cate; my $self=shift; print "$self->{InputFile}\n"; (open my $FILE_H '<', $self->{InputFile}) || die"cannot open the input file"; while(<$FILE_H>) { next unless /(<div.*?<\/table><br><br>)/; my @Rows=grep(/(<div.*?<\/table><br><br>)/,<$FILE_H>); return(@Rows); close $FILE_H; } 1; __________________PACKAGE And I am using this package in the following script and trying to get the some values. --script use strict; use warnings; use grepsite; my $obj=grepsite->new("sample.txt"); my @rows=$obj-> GET_Values; $obj-> Print_file(@rows); --script I am getting the following error,my Input file exists. -----------------ERROR Use of uninitialized value in concatenation (.) or string at grepsite.pm line 37 . InputFile in GET_TABLES Method is parseSite=HASH(0x225f88) 1 Use of uninitialized value in concatenation (.) or string at grepsite.pm line 26 . Use of uninitialized value in concatenation (.) or string at grepsite.pm line 27 . Use of uninitialized value in concatenation (.) or string at grepsite.pm line 28 .._-----------------------------ERROR. I understand this is because the file $self->{InputFile} is not visible to the method GET_Values Whats the reason that this file is not visible to the GET_Values method. Can somebody let me know where I am going wrong? Thanks PP.
<<image001.gif>>