I have a bunch of files saved with CGI.pm's built-in "save" function. Here's an 
example of what's in a file:

Name=Lincoln Stein
Home=/u/bush202/lds32
Organization=Cold Spring Harbor Laboratory
Login=lds32
Password_age=20
Password_expires=60
=

I want to do some searches on the those files and Boulder.pm looks like it 
might help do exactly what I want, but I'm stumped with the example Dr.Stein 
provides (http://stein.cshl.org/software/boulder/docs/Boulder.html):

   # Read a series of People records from STDIN.
   # Add an "Eligibility" attribute to all those whose
   # Age >= 35 and Friends list includes "Fred"
   
   use Boulder::Stream;
   
   my $stream = Boulder::Stream->newFh;
   
   while ( my $record = <$stream> ) {
      next unless $record->Age >= 35;
      my @friends = $record->Friends;
      next unless grep {$_ eq 'Fred'} @friends;

      $record->insert(Eligibility => 'yes');
      print $stream $record;
    }


I'm not using this is a shell script, it's a CGI script, so what I want to do 
is send the routine in the example a path to a directory of files I'd like it 
to search through. 

But I don't know how to do that, I've tried a few different things, like,

        open(newFh, "data.txt") or die "couldn't open data.txt : $!";
        my $stream = Boulder::Stream->newFh;
 
But I get this error:

Name "main::newFh" used only once: possible typo

I'm just not getting anywhere.  Can anyone tell me what I'm doing wrong?

Kindest Regards,

Bill Stephenson




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to