lawrence@epps.kodak.com (Scott Lawrence) (01/03/91)
The perl man page says "Undef will pobably not do what you expect on ... dbm array values". What exactly _does_ it do? Given dbmopen( %Control, "dbmfilename", 0660 ); will undef $Control{ "foo" }; remove the key (and associated value) "foo" from the file "dbmfilename"? If not, is there a way to do so? Please reply by mail - I will summarize to the net. -- Scott Lawrence <lawrence@epps.kodak.com> <s.lawrence@ieee.org> Atex Advanced Publishing Systems, Voice: 508-670-4023 Fax: 508-670-4033 Electronic Pre-Press Systems; 165 Lexington St. 400/165L; Billerica MA 01821 -- --- Scott Lawrence <lawrence@epps.kodak.com> <s.lawrence@ieee.org> Atex Advanced Publishing Systems, Voice: 508-670-4023 Fax: 508-670-4033 Electronic Pre-Press Systems; 165 Lexington St. 400/165L; Billerica MA 01821
merlyn@iwarp.intel.com (Randal L. Schwartz) (01/03/91)
In article <5073@atexnet.UUCP>, lawrence@epps (Scott Lawrence) writes: | | The perl man page says "Undef will pobably not do what you expect on ... dbm | array values". | | What exactly _does_ it do? | | Given | | dbmopen( %Control, "dbmfilename", 0660 ); | | will | | undef $Control{ "foo" }; | | remove the key (and associated value) "foo" from the file "dbmfilename"? I dunno. It might give the "undef" value to $Control{"foo"}. But I don't know how that would be stored on disk. | If not, is there a way to do so? delete $Control{"foo"} is the proper way. Removes "foo" from keys(%Control), and on disk too. ObJAPH: print "Just another Perl hacker," -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/
tchrist@convex.COM (Tom Christiansen) (01/03/91)
From the keyboard of lawrence@epps.kodak.com: :The perl man page says "Undef will pobably not do what you expect on ... dbm :array values". :What exactly _does_ it do? :Given : dbmopen( %Control, "dbmfilename", 0660 ); :will : undef $Control{ "foo" }; :remove the key (and associated value) "foo" from the file "dbmfilename"? :If not, is there a way to do so? :Please reply by mail - I will summarize to the net. I tried to reply but the mail bounced. You want to use delete, not undef, to get rid of it entirely. Otherwise you'll have a key whose value is undef, as opposed to not having the key at all. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "With a kernel dive, all things are possible, but it sure makes it hard to look at yourself in the mirror the next morning." -me