SDBM_File(3pm) Perl Programmers Reference Guide SDBM_File(3pm)NAME
SDBM_File - Tied access to sdbm files
SYNOPSIS
use Fcntl; # For O_RDWR, O_CREAT, etc.
use SDBM_File;
tie(%h, 'SDBM_File', 'filename', O_RDWR|O_CREAT, 0666)
or die "Couldn't tie SDBM file 'filename': $!; aborting";
# Now read and change the hash
$h{newkey} = newvalue;
print $h{oldkey};
...
untie %h;
DESCRIPTION
"SDBM_File" establishes a connection between a Perl hash variable and a file in SDBM_File format;. You can manipulate the data in the file
just as if it were in a Perl hash, but when your program exits, the data will remain in the file, to be used the next time your program
runs.
Use "SDBM_File" with the Perl built-in "tie" function to establish the connection between the variable and the file. The arguments to
"tie" should be:
1. The hash variable you want to tie.
2. The string "SDBM_File". (Ths tells Perl to use the "SDBM_File" package to perform the functions of the hash.)
3. The name of the file you want to tie to the hash.
4. Flags. Use one of:
"O_RDONLY"
Read-only access to the data in the file.
"O_WRONLY"
Write-only access to the data in the file.
"O_RDWR"
Both read and write access.
If you want to create the file if it does not exist, add "O_CREAT" to any of these, as in the example. If you omit "O_CREAT" and the
file does not already exist, the "tie" call will fail.
5. The default permissions to use if a new file is created. The actual permissions will be modified by the user's umask, so you should
probably use 0666 here. (See "umask" in perlfunc.)
DIAGNOSTICS
On failure, the "tie" call returns an undefined value and probably sets $! to contain the reason the file could not be tied.
"sdbm store returned -1, errno 22, key "..." at ..."
This warning is emitted when you try to store a key or a value that is too long. It means that the change was not recorded in the
database. See BUGS AND WARNINGS below.
BUGS AND WARNINGS
There are a number of limits on the size of the data that you can store in the SDBM file. The most important is that the length of a key,
plus the length of its associated value, may not exceed 1008 bytes.
See "tie" in perlfunc, perldbmfilter, Fcntl
perl v5.16.3 2013-03-04 SDBM_File(3pm)
I need to use bash to convert sentences where all words start with a small letter into one where all words start with a capital letter.
So that a string like:
are utilities ready for hurricane sandy
becomes:
Are Utilities Ready For Hurricane Sandy (10 Replies)
Hi
I am new to this forum.
Any please help me to capture ctrl x and ctrl y via a bash script.
and please tell me how to clear the prompt via bash script
BR
Ramukumar M (4 Replies)
I have an Oracle Linux 7.1 vsphere host built. It's be preconfigured with our security configurations.
What I would like to do is unconfigure this host. Then set the host to do firstboot --reconfigure.
how do I do that using /etc/sysconfig/firstboot?
I've tried setting
... (10 Replies)
i know from the command line, the symbol $_ is used to get the last command that was run.
however, id like to replicate this within a script.
meaning, how do i do something like this:
#!/bin/sh
ps -ef | egrep talling
StoreThisLastCommandA=$_
awk '/error/ {print $3}' /tmp/test... (5 Replies)
hi folks,
how to using tar with exclude directory and compress it using tar.Z
i only know how to exclude dir only with this command below:
tar -cvf /varios/restore/test.tar -X excludefile.txt /jfma/test1/
how to compress it using 1 command?
Thanx
Please use CODE tags as... (6 Replies)
Quite an obscure question I think.
We have a rebuild process for remote sites that allows us to PXE rebuild a till (actually a PC with a touch screen and various fancy bits) running CentOS. The current CentOS5 tills work just fine with a tar image restore and some personalisation. Sadly,... (4 Replies)
Hello All,
I had recently learnt a bit of Docker(which provides containerization process).
Here are some of my learning points from it.
Let us start first with very basic question:
What is Docker:
Docker is a platform for sysadmins and developers to DEPLOY, DEVELOP and RUN applications ... (7 Replies)
Hi Folks,
I feel that I should be posting this in the Unix for Dummies Forum and will probably wish I'd created an account and done just that - but here goes anyway.
I have two identical servers both Dell R430's both running RedHat Enterprise Server 7.4 and the same kernel, both have the same... (16 Replies)
Hi,
What is installation package and how to create it?
When we run:
in AIX:
installp package1
or
in Linux
rpm -ivh mypackage
What is package1 or mypackage in the abov examples and how to create them and deploy them?
I hope my question is clear enough.
Thank you (2 Replies)
What is the point of this? Whenever I close my shell it appends to the history file without adding this. I have never seen it overwrite my history file.
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend (3 Replies)
After the success of the jq - tool for parsing and manipulating JSON-Data someone wrote a tool called yq, which aims to be the same for YAML, what jq is for JSON. Seems to work fine. I'll definitely give it a chance in future.
Example YAML-File:
--- !ruby/object:Puppet::Node::Facts
... (1 Reply)