[LON-CAPA-cvs] cvs: modules /minaeibi l.pl

minaeibi lon-capa-cvs@mail.lon-capa.org
Fri, 30 Aug 2002 20:35:38 -0000


minaeibi		Fri Aug 30 16:35:38 2002 EDT

  Added files:                 
    /modules/minaeibi	l.pl 
  Log:
  This a new file.
  
  

Index: modules/minaeibi/l.pl
+++ modules/minaeibi/l.pl
use GDBM_File;    
my %hash;
my $str;
$file=$ARGV[0];
$count = 0;
print "Using $file\n";
tie(%hash,'GDBM_File',$file, &GDBM_WRCREAT,0640);
foreach $key (keys %hash) {
  $count++;
  $str = escape( $key );
  $val = escape( $hash{$key} );
  my ( $dom, $ins, $prob ) = split( /\:/, escape( $str ) );

  print "$count)\t$dom\t$ins\t$prob = $val\n";
}

untie %hash;


sub escape {
	my $str=shift;
	$str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1) )/eg;
	return $str;
}