Note: on Windows. . . I don't use dbm's extensively, but it does come up. . .
perl -e "use SDBM_File;use Fcntl;tie %h, 'SDBM_File', 'H:\dbm\mydbmfil
+e',
O_RDWR, 0600;for (sort keys %h){print \"$_=$h{$_}\n\";}"
or
H:\>perl -e "use SDBM_File;use Fcntl;tie %h, 'SDBM_File', 'H:\dbm\mydb
+mfile',
O_RDWR, 0600;map {print \"$_=$h{$_}\n\";} sort keys %h;"
I may eventually put one of these into a script, I guess, but it's kind of short. I use a similar sort of technique for some other small manipulations (such as when I want to change the value of one key or something).
They're also the first one liners I've really used besides ultra-simple ones like perl -v.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|