Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!ccut!wnoc-tyo-news!astemgw!icspub!creamy!iegva1!rdmei!himazu From: himazu@isl.mei.co.jp (IMAZU Hideyo) Newsgroups: comp.lang.perl Subject: suggestion for dbmopen Message-ID: Date: 12 Jan 91 02:44:29 GMT Sender: news@isl.mei.co.jp Distribution: comp Organization: Matsushita Eletric Industorial Co., Ltd. Japan Lines: 35 "open" take an expression as FILEHANDLE argument. But "dbmopen" doesn't take an expression as ASSOC argument. In some situations, it is useful that "dbmopen" take an expression as ASSOC. For example, in a code as follows. @dbspec = ('data_a', 'a_file', 'data_b', 'b_file'); &dbopen(@dbspec); $data_a{...} = .... ....$data_b{...} ... .. &dbclose(@dbspec); .. .. sub dbopen { while ( @_ > 1 ) { dbmopen($_[0], $_[1], 0600) || die "cannot open $_[1]"; shift @_; shift @_; } } sub dbclose { while ( @_ > 1 ) { dbmclose($_[0]); shift @_; shift @_; } } -- IMAZU Hideyo(Imazu is my family name) himazu@isl.mei.co.jp Matsushita Electric/Panasonic, Osaka, Japan