Perl : converting file to different scalar elements


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl : converting file to different scalar elements
# 8  
Old 12-13-2015
Quote:
Originally Posted by scriptscript
[...]
Now @array contains both the query. Now I want to make those queries into two scalars.
[...]
Hi John,

The query strings are already a scalar each time through the loop, they are called $line

If my guess is correct you want to use that $line to execute the query via a system call. Unfortunately, that would be wrong in many ways, and it would take a lot of explanation.

Perhaps, these two links might help you how to use the DBI module to interface with a database.
An Embarrassing Confession
Using Perl DBI

If any of those links are not working, please search for Perl and DBI
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl : to get the no. of elements from DataDumper

Hello Folks, I have a DataDumper variable and the output of the dataDumper is printed in the below manner. print Dumper \%mnemonics; VAR1 = { 'SYS-7-CLI_SCHEDULER_LOG_STORED' => , 'CRYPTO-6-IKMP_MODE_FAILURE' => , 'AAAA-4-SERVUNDEF' => , ... (1 Reply)
Discussion started by: scriptscript
1 Replies

2. Shell Programming and Scripting

Array elements comparison using perl

Experts, I am looking to compare elements of 2 array using perl. Below is not the actual code but logic wise something like this. my $version = "MYSQlcl-5.2.4-264.x86_64"; <-- split this word into array as (5 2 4 264) ( which is to extract only the version number from the package name) my... (1 Reply)
Discussion started by: solaix14
1 Replies

3. Shell Programming and Scripting

Help required converting XSD to XML file in PERL

Hi, Please find below the xsd. <?xml version="1.0" encoding="ISO-8859-1" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="fruitorder"> <xs:complexType> <xs:sequence> <xs:element name="orderperson"... (2 Replies)
Discussion started by: vanitham
2 Replies

4. Shell Programming and Scripting

Perl Array Elements Replacement

Hello, I have the following perl array: @longname = (Fasthernet0/0 Fasthernet0/1 Serial0/1/0 Serial0/2/1 Tunnel55 Tunnel77) with the followinh array: @shortname = (Fa0/0 Fa0/1 Se0/1/0 Se0/2/1 Tu55 Tu77) in other words, I need to remove the following from each element in the array... (4 Replies)
Discussion started by: ahmed_zaher
4 Replies

5. Shell Programming and Scripting

perl DBI: populate a scalar from a select statement

hi every resource i see regarding DBI refers to retrieving data from a database into and array or a hash, but i havent seen anything on how to pull out a single value to a scalar in my database i have a field called "forcewrite" with a value of "6". I am trying to connect to the database,... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

6. Shell Programming and Scripting

Perl:Use of array elements in pattern matching

I need to use array elements while pattern matching. @myarr = (ELEM1, ELEM2, ELEM3); following is the statement which I am using in my code. Basically I want to replace the ELEM1/2/3 with other thing which is mentioned as REPL here. if (condition) { s/(ELEM1|ELEM2|ELEM3): REPL: /; } I... (3 Replies)
Discussion started by: deo_kaustubh
3 Replies

7. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

8. Shell Programming and Scripting

Perl - New line in array elements

Hello, I have a comma delimited input feed file. The first field has directory location and the second field has file name. Ex of input feed: /export/appl/a,abc*.dat /export/appl/b,xyz*.dat /export/appl/c,pmn*.dat Under each directory, there would be many files like... . . .... (4 Replies)
Discussion started by: bperl
4 Replies

9. Shell Programming and Scripting

scalar variable assignment in perl + { operator

When reading over some perl code in a software document, I came across an assignment statement like this $PATH = ${PROJECT}/......./.... In this particular form of scalar variable assignment, what does the curly braces operators do ? Also, what is the benefit in doing scalar assignment this... (3 Replies)
Discussion started by: JamesGoh
3 Replies

10. Shell Programming and Scripting

perl scalar variable in backquoted string

hi I've been searching all over the internet to simply do the following: $tempfile = "/usr/school/tempfile.dat"; $myvar = param('add'); ###add is the variable assigned to a popup menu `ls -l $myvar * >> $tempfile` ###I also tried `ls -l ${myvar}* >>$tempfile` open(ADDLIST,... (6 Replies)
Discussion started by: mehdi9
6 Replies
Login or Register to Ask a Question
Gtk2::Gdk::Geometry(3)					User Contributed Perl Documentation				    Gtk2::Gdk::Geometry(3)

NAME
Gtk2::Gdk::Geometry METHODS
geometry = Gtk2::Gdk::Geometry->new scalar = $object->base_height ($newvalue=undef) o $newvalue (scalar) scalar = $object->base_width ($newvalue=undef) o $newvalue (scalar) (new_width, new_height) = $geometry->constrain_size ($width, $height) (new_width, new_height) = $geometry->constrain_size ($flags, $width, $height) o ... (list) o $flags (Gtk2::Gdk::WindowHints) optional, usually inferred from $geometry The $flags argument, describing which fields in the geometry are valid, is optional. If omitted it will be inferred from the geometry itself. scalar = $object->gravity ($newvalue=undef) o $newvalue (scalar) scalar = $object->height_inc ($newvalue=undef) o $newvalue (scalar) scalar = $object->max_aspect ($newvalue=undef) o $newvalue (scalar) scalar = $object->max_height ($newvalue=undef) o $newvalue (scalar) scalar = $object->max_width ($newvalue=undef) o $newvalue (scalar) scalar = $object->min_aspect ($newvalue=undef) o $newvalue (scalar) scalar = $object->min_height ($newvalue=undef) o $newvalue (scalar) scalar = $object->min_width ($newvalue=undef) o $newvalue (scalar) scalar = $object->width_inc ($newvalue=undef) o $newvalue (scalar) scalar = $object->win_gravity ($newvalue=undef) o $newvalue (scalar) ENUMS AND FLAGS
flags Gtk2::Gdk::WindowHints o 'pos' / 'GDK_HINT_POS' o 'min-size' / 'GDK_HINT_MIN_SIZE' o 'max-size' / 'GDK_HINT_MAX_SIZE' o 'base-size' / 'GDK_HINT_BASE_SIZE' o 'aspect' / 'GDK_HINT_ASPECT' o 'resize-inc' / 'GDK_HINT_RESIZE_INC' o 'win-gravity' / 'GDK_HINT_WIN_GRAVITY' o 'user-pos' / 'GDK_HINT_USER_POS' o 'user-size' / 'GDK_HINT_USER_SIZE' SEE ALSO
Gtk2 COPYRIGHT
Copyright (C) 2003-2008 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.12.1 2010-07-05 Gtk2::Gdk::Geometry(3)