Hi,
The task i have to do is to
1- create a database contains the Names .run the query and store results in hash make the Name field is the hash key
2- in the same time i have a txt which i will loop through it word by word and check for each word if a hash key ( compare it with the Names in the Name field in the hash ) or not if it is a key print it to a txt file and print that it match the database.
Now , the code can get the results from db in a hash form with the key field Name andin the same time loop through the input txt word by word
But till now i can't compare these words withthee names stored in the hash to know if it match or not.
I am abeginner and really i arrive to this level after alot of efforts and i can't go ahead with code any more. So really i need your help.
i've reworked some code from an earlier post, and it isn't working as expected
i've simplified it to try and find the problem. i spent hours trying to figure out what is wrong, eventually thinking there was a bug in perl or a problem with my computer. but, i've tried it on 3 machines with the... (5 Replies)
hello again, i've checked many sites for examples and am amazed that i can't find a simple example of an if statement to test for an alphanumber value ie:
if($key == "a" )
to run this pgm: perl del3.pl delin
delin data is:
a=1
b=2
c=3
thanks for any pointers
ps: java programmer... (7 Replies)
Hi,
Now i work in a code that
1-get data stored in the database in the form of hash table with a key
field which is the " Name"
2-in the same time i open a txt file and loop through it word by word
3- which i have a problem in is that :
I need to loop word by word and check if it is a... (0 Replies)
Hello,
I have a hash in hsh. I need to assign it to another hash globalHsh. I think the below statement does not work
$globalHsh{$id} = %hsh;
What is the right way to assign it?
Thanks (3 Replies)
Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below.
#!/usr/bin/perl
use warnings;
use Tie::IxHash;
use strict;
tie (my %programs, "Tie::IxHash");
while (my $line = <DATA>) {
chomp $line;
my(... (1 Reply)
Hi,
In Perl, is it possible to use a range of numbers with '..' as a key in a hash?
Something in like:
%hash = (
'768..1536' => '1G',
'1537..2560' => '2G'
);
That is, the range operation is evaluated, and all members of the range are... (3 Replies)
Hi,
I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all .
my %result (
$abc => {
'data_count' => '10',
'ID' => 'ABC122',
}
$def => {
'data_count' => '20',
'ID' => 'defASe',
... (1 Reply)
My issue is that the perl script (as I have done it so far) created empty branches when I try to check some branches on existence.
I am using multydimentional hashes: found it as the best way for information that I need to handle. Saing multidimentional I means hash of hashes ... So, I have
... (2 Replies)
Experts - Any advice on how to get a hash value in a foreach loop?
Values print correctly on standalone print statements, but I can't access value
in foreach loop.
See sample code below and thanks in advance.
foreach my $z (sort keys %hash) {
for $y (@{$hash{$z}}) {
print "$z... (6 Replies)
I'm trying to make a perl script using the "open" command to open and read a file, storing the information in said file into a hash structure.
This is what is inside my file-
Celena Standard F 01/24/94 Cancer
Jeniffer Orlowski F 06/24/86 None
Brent Koehler M 12/05/97 HIV
Mao Schleich... (4 Replies)
Discussion started by: Eric1
4 Replies
LEARN ABOUT REDHAT
dbi::format
DBI::Format(3) User Contributed Perl Documentation DBI::Format(3)NAME
DBI::Format - A package for displaying result tables
SYNOPSIS
# create a new result object
$r = DBI::Format->new('var1' => 'val1', ...);
# Prepare it for output by creating a header
$r->header($sth, $fh);
# In a loop, display rows
while ($ref = $sth->fetchrow_arrayref()) {
$r->row($ref);
}
# Finally create a trailer
$r->trailer();
DESCRIPTION
THIS PACKAGE IS STILL VERY EXPERIMENTAL. THINGS WILL CHANGE.
This package is used for making the output of DBI::Shell configurable. The idea is to derive a subclass for any kind of output table you
might create. Examples are
o a very simple output format as offered by DBI::neat_list(). "AVAILABLE SUBCLASSES".
o a box format, as offered by the Data::ShowTable module.
o HTML format, as used in CGI binaries
o postscript, to be piped into lpr or something similar
In the future the package should also support interactive methods, for example tab completion.
These are the available methods:
new(@attr)
new(\%attr)
(Class method) This is the constructor. You'd rather call a subclass constructor. The construcor is accepting either a list of
key/value pairs or a hash ref.
header($sth, $fh)
(Instance method) This is called when a new result table should be created to display the results of the statement handle $sth. The
(optional) argument $fh is an IO handle (or any object supporting a print method), usually you use an IO::Wrap object for STDIN.
The method will query the $sth for its NAME, NUM_OF_FIELDS, TYPE, SCALE and PRECISION attributes and typically print a header. In
general you should not assume that $sth is indeed a DBI statement handle and better treat it as a hash ref with the above
attributes.
row($ref)
(Instance method) Prints the contents of the array ref $ref. Usually you obtain this array ref by calling
$sth->fetchrow_arrayref().
trailer (Instance method) Once you have passed all result rows to the result package, you should call the trailer method. This method can,
for example print the number of result rows.
AVAILABLE SUBCLASSES
First of all, you can use the DBI::Format package itself: It's not an abstract base class, but a very simple default using
DBI::neat_list().
Ascii boxes
This subclass is using the Box mode of the Data::ShowTable module internally. Data::ShowTable(3).
Raw
Row is written without formating. Columns returned in comma or user defined separated list.
String
Row is written using a string format. Future releases will include th ability set the string format.
AUTHOR AND COPYRIGHT
This module is Copyright (c) 1997, 1998
Jochen Wiedmann
Am Eisteich 9
72555 Metzingen
Germany
Email: joe@ispsoft.de
Phone: +49 7123 14887
The DBD::Proxy module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO DBI::Shell(3), DBI(3), dbish(1)perl v5.8.0 2002-11-29 DBI::Format(3)