Visit Our UNIX and Linux User Community

Full Discussion: Perl newbie question
Top Forums Shell Programming and Scripting Perl newbie question Post 302072744 by buffoonix on Friday 5th of May 2006 07:22:14 PM
Old 05-05-2006
perldoc DBI
will tell you ;-)
But to be of little more help,
it's been quite a while since I last have written Perl code that used the DBI.
Thus it's likely I forgotten most of DBI.
But if I remember correctly,
the fetched hash'es keys are the field names of the table items
that you prepared in your select statement.
Since NAME_lc is passed you can safely reference the keys all lower case.
Hint, in Oracle's sqlplus you could issue a desc on the table you select
to see the field names.
Once the result set is fetched in your hashref it's very easy to refer to the fields
thanks to Perl's arrow operator.
Since I don't know you table's fields I use field_N here.
my $field_1 = $hash_ref->{field_1};
my $field_5 = $hash_ref->{field_5};

But you could also reference them collectively by a hash slice.
my ($field_2, $field_7, $field_3) = @{$hash_ref}{qw(field_2 field_7 field_3)};

But admittedly, this looks rather ugly,
and referencing like this gave Perl the reputation of line noise and obfuscation.
Test Your Knowledge in Computers #427
Difficulty: Easy
JavaScript supports only explicit delegation.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Newbie question

Hello, I have text file while looks this test1 test2 test3 test4 test5 test6 and if I want to parse it and make new file which would like this test1 test2 test3 test4 test5 test6 How can I do this in korn shell script Thanks (9 Replies)
Discussion started by: peeyush_23
9 Replies

2. UNIX for Dummies Questions & Answers

Very new newbie question

sorry if im not asking inthe right spot but, how do you turn the beeping off every time you hit a key onthe keyboard. I tried the click -n but it told me it didnt recognize click any help would be greatly appreciated ( the beeping is not going over well in the surrounding cubicles) thank you... (4 Replies)
Discussion started by: Split100
4 Replies

3. UNIX for Dummies Questions & Answers

UNIX newbie NEWBIE question!

Hello everyone, Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware. I hope I am not missing anything! :p (4 Replies)
Discussion started by: Hanamachi
4 Replies

4. Shell Programming and Scripting

perl newbie . &&..programming newbie (question 2)

Hello everyone, I am having to do a lot of perl scripting these days and I am learning a lot. I have this problem I want to move files from a folder and all its sub folders to one parent folder, they are all .gz files.. there is folder1\folder2\*.gz and there are about 50 folders... (1 Reply)
Discussion started by: xytiz
1 Replies

5. Shell Programming and Scripting

perl newbie . &&..programming newbie

Hi, I am new to programming and also to perl..But i know 'perl' can come to my rescue, But I am stuck at many places and need help..any small help is much appreciated... below is the description of what i intend to acheive with my script. I have a files named in this format... (13 Replies)
Discussion started by: xytiz
13 Replies

6. UNIX for Dummies Questions & Answers

perl newbie question

I have the following question in perl, I have come up with couple of solutions,Perl gurus please help me find the best answer to my question? You have a PERL database named DataEntryData, and you need to separate out the various values from the DB entry $item, delimited by the ^ sumbol. There... (2 Replies)
Discussion started by: ramky79
2 Replies

7. Shell Programming and Scripting

Perl newbie question re: variables

Hi there apologies for the really basic question but if i have a variable called $string that I want to run a regex against and output to another variable do i do it, I know that if i wanted to alter the current $string variable i would do $string=~ s/old/new/g; but i kind of want... (2 Replies)
Discussion started by: rethink
2 Replies

8. UNIX for Dummies Questions & Answers

newbie question

Hi all, I am sure this is very simple but I cant quite get it. I am trying to search textfile1.txt for a string then take the results of the search and append the result to textfile3.txt So far I have used $ find file1.txt -exec grep "string i am looking for" '{}' \; -print this... (2 Replies)
Discussion started by: radgator
2 Replies

9. Shell Programming and Scripting

Hidden Characters in Regular Expression Matching Perl - Perl Newbie

I am completely new to perl programming. My father is helping me learn said programming language. However, I am stuck on one of the assignments he has given me, and I can't find very much help with it via google, either because I have a tiny attention span, or because I can be very very dense. ... (4 Replies)
Discussion started by: kittyluva2
4 Replies

10. Shell Programming and Scripting

What does this do (newbie question)...

I was looking through some code online and came accross this... ls *.txt | grep text1 | cat file1 – file2 | `echo wc –l` I know what "ls|grep text1" does and I know a word count gets echoed but beyond that I am confused. Please use layman terms as much as possible as I am a newbie. (8 Replies)
Discussion started by: elohssa
8 Replies

odbc_specialcolumns - Retrieves special columns

resource odbc_specialcolumns (resource $connection_id, int $type, string $qualifier, string $owner, string $table, int $scope, int $nullable) DESCRIPTION
Retrieves either the optimal set of columns that uniquely identifies a row in the table, or columns that are automatically updated when any value in the row is updated by a transaction. PARAMETERS
o $connection_id -The ODBC connection identifier, see odbc_connect(3) for details. o $type - When the type argument is SQL_BEST_ROWID, odbc_specialcolumns(3) returns the column or columns that uniquely identify each row in the table. When the type argument is SQL_ROWVER, odbc_specialcolumns(3) returns the column or columns in the specified table, if any, that are automatically updated by the data source when any value in the row is updated by any transaction. o $qualifier - The qualifier. o $owner - The owner. o $table - The table. o $scope - The scope, which orders the result set. o $nullable - The nullable option. RETURN VALUES
Returns an ODBC result identifier or FALSE on failure. The result set has the following columns: oSCOPE oCOLUMN_NAME oDATA_TYPE oTYPE_NAME oPRECISION oLENGTH oSCALE oPSEUDO_COLUMN PHP Documentation Group ODBC_SPECIALCOLUMNS(3)

Featured Tech Videos

All times are GMT -4. The time now is 02:48 AM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy