Hey guys/girls,
I want to make a list of structures from a file. Then once I get the
structures check to see if a particular value matches any in the list of
structurs that I have created. If there is a match then return the
pointer to the matching structure. Check the code below and let me know
if I am on the write track. Assuming I am creating object and calling
the method correctly.
sub new {
my ($class,$rulenumber,$value,$type,$value,$comment) = @_;
$class = $_[0];
my $r_section = { #creates unique object
"Rulenumber" => $rulenumber,
"Type" => ["a","b","c"],
"Value" => $value,
"Comment" => $comment,
};
return bless ($r_section,$class); #returns object
}
sub find {
my ($self,$r_Obj,$rule) = @_;
#$r_Obj is a pointer to an array of pointers that were created from
routine above
#$rule is the rule I am looking for.
foreach $item ($r_Obj){
if($rule eq $item->{'Rulenumber'}){
return($item); #This will return a matching rulenumber
}#endif
}#endfor
}#endsub
Thanks
Perlknucklehead
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>