473,513 Members | 2,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

subroutine input from external txt file?

4 New Member
Hi,

I need to have a Perl script run a query command using ten different input variables that exist in a separate text file and save the output of each query into the same (new) external text file.

Questions:
1. What are the proper Perl terminologies that define my objectives (ie: subroutines, etc.)?

2. Can you direct me to any links that will give me examples / test scripts?

Thanks in advance for your time and assistance.

-TechQA
Feb 12 '09 #1
7 2686
numberwhun
3,509 Recognized Expert Moderator Specialist
@TechQandA
First, we don't provide test scripts and I don't have any resources for any. This is a learning forum and we will help you when you get stuck.

My first suggestion is that you get a Perl book, like "Learning Perl" and read it and learn Perl. Also, you can reference the perldoc resource as much of the documentation on Perl itself is there at your disposal.

Why don't you try and write something. Then, when you get stuck, post your code here (in code tags) for us to see and point you in the right direction.

Regards,

Jeff
Feb 12 '09 #2
TechQandA
4 New Member
Hi Jeff,

I have two books: "Learning Perl" and "Perl Core Language Little Black Book". I'm a newbie working on my first script and am more confused the more I read. I understand how this forum works and am not not looking for someone to write a script for me, but any suggestions (and direction assistance) on the correct type of Perl topics I should be reviewing (ie: subroutines, etc.) would be very helpful to me.

Thank you,

-TechQA
Feb 12 '09 #3
KevinADC
4,059 Recognized Expert Specialist
Whats a query command?
Feb 12 '09 #4
TechQandA
4 New Member
I'm writing a Perl script to run queries against a Tivoli TSM (backup system) database to define the status of a list of tape volumes. Each day there will be a different list of tape volume numbers that I need to have this script process (In Perl-speak, I think this is a subroutine that will 'read' the first line of a text file, place it into the query, save the output to a new text file and repeat the process until it has read through all lines of the source text file and appended all the outputs into the same 'new' text file).
Feb 12 '09 #5
numberwhun
3,509 Recognized Expert Moderator Specialist
@TechQandA
If you are interacting with Tivioli, then you may want to look at any of the number of modules on CPAN.

If its a database that you are directly querying, then you want to write perl code using the Perl DBI interface.

I wasn't trying to imply that you don't know how the forum works, I was just giving my standard speech. Why not post the code you are working on (again, in code tags) and we will work with you to get it working.

Regards,

Jeff
Feb 12 '09 #6
KevinADC
4,059 Recognized Expert Specialist
Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. open (my $IN, "<" , 'path/to/queryfile.txt') or die "$!";
  4. while (my $line = <$IN>) {
  5.    chomp $line;
  6.    # here do something with $line
  7. }   
  8.  
Like Jeff said, if you are querying a database you probably want to use the DBI module for the DB interaction stuff. I don't know anything about TiVoli TSM so I can't help there. Search CPAN as suggested.
Feb 13 '09 #7
TechQandA
4 New Member
Jeff and Kevin,

Thanks for your input and assistance with my post. I'll work on the this over the next week and post a new topic question if/when I have one.

Have a great weekend,

-TechQA
Feb 13 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3268
by: conglomco | last post by:
I a trying to make a form that displays the results of radio buttons, to the user, and at the same time parses the results to an html file to be uses on a larger page. I have some debugging commands...
11
543
by: RichN | last post by:
I am developing a c program in Visual Studio .NET 2003. I also have an Intel(R) Fortran compiler for MVS .NET My fortran sourcecode already existed. I started a new fortran project and chose to...
2
1668
by: Magnus | last post by:
I'm currently developing an application with classified information as input to a couple of algorithms. Which strategy should I use to protect the input data from beeing read? The files should...
1
1464
by: dgr7 | last post by:
hello, I have a file BLURG.txt in a subdirectory D:\B HC\NewB that I'd like to, using a VB6 subroutine, pass as a variable to the subroutine the name of the file & directory where it can be...
1
1894
by: peterv6 | last post by:
I'm using a "package" type subroutine, called test_package.pl. I'm calling it from a script called split0.pl. I want to pass the $0 variable, use the subroutine to split out just the filename, and...
3
13597
by: sangith | last post by:
Hi, I have question on processing the file handle in a subroutine. Here is my program without subroutine: open FH1, "<outfile" or die "cannot open the file for reading: $!\n"; while...
1
1529
by: johnperl | last post by:
Can any one please help me. Everything here works perfect except the other subroutine “&sftp()” , it works fine too when used before “&excel()” subroutine. But I want to transfer the file after it is...
4
1666
by: ashashi87 | last post by:
I'm extremely new to perl. I decided to pick it up recently and was writing some elementary code just to get the hang of things. In doing so I've come across a stumbling block for which I couldn't...
2
1605
by: PVACC | last post by:
The following line of script code works correctly: w('<input type=radio name=rad onclick="myImg.src=\'../Audio Streaming/'+myPhoto+'\';">'); When onclick is executed, the variable "myPhoto" is...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5084
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.