Re: Reading from Pipe and Command Line

2003-06-25 Thread Jeff Westman
--- Paul Johnson <[EMAIL PROTECTED]> wrote: > On Wed, Jun 25, 2003 at 01:09:41PM -0700, Jeff Westman wrote: > > > Could someone help me please? > > > > I am trying to write a simple script that will take input from the > command > > line as well as input

Reading from Pipe and Command Line

2003-06-25 Thread Jeff Westman
Could someone help me please? I am trying to write a simple script that will take input from the command line as well as input from a pipe. For example, the script should be able to do both of the following: $ cat someFile | myPerlScript.pl # from a pipe and $ myPerlScript.pl someFile

Reading from STDIN from a pipe

2003-06-24 Thread Jeff Westman
Hi, I am trying to get my script to be able to read from the command line arguments as well as take input from a pipe. This is what I have basically: #--- (begin) # #!/bin/perl use warnings; sub parseFile() { while () { # do some processing to

Odd Display using Perl5.8 in Debug

2003-06-24 Thread Jeff Westman
Hi, I have sort of a strange problem, and if anyone has a fix for it, please let me know. I don't know if this is perl-related or my software package. I am using 'Reflection X' for telneting. It's a great communications package, witht he exception of one annoying nuance. When I am debugging a

perldoc - html format ?

2003-06-20 Thread Jeff Westman
Hi, Is it possible to reformat a perldoc in HTML format? I don't see this as an option to 'perldoc'. Thanks Jeff __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional command

Re: Stupid(?) Question on System "set"

2003-06-19 Thread Jeff Westman
--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > On Jun 19, Jeff Westman said: > > > 1 #!/bin/perl -w > > 2 > > 3 @a = qx{set}; > > >Can't exec "set": No such file or directory at ./x line 3. > > > >

Stupid(?) Question on System "set"

2003-06-19 Thread Jeff Westman
I am trying to see what variables are set in my (parent) environment. The following gives me an error: 1 #!/bin/perl -w 2 3 @a = qx{set}; 4 5 print foreach (@a); 6 Error message: Can't exec "set": No such file or directory at ./x line 3. Yet, using qx{env} works

Re: Perl debug

2003-06-19 Thread Jeff Westman
Peter- When I tried the 'y' command I got: DB<3> y @a adWalker module not found - please install What's that about?! Jeff --- Peter Scott <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Steve Grazzini) writes: > >On Wed, Jun 18, 2003 at 05:21:06PM -0700,

Re: Scalars and Strict

2003-06-05 Thread Jeff Westman
Hi Rob, --- Rob Dixon <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > --- George Schlossnagle <[EMAIL PROTECTED]> wrote: > > > > > > On Wednesday, June 4, 2003, at 02:40 PM, Wagner, David --- Senior > > > Programmer Analyst --- WGO wrote: >

Re: Scalars and Strict

2003-06-05 Thread Jeff Westman
I like this solution! Cool Thanks George and David. JW --- George Schlossnagle <[EMAIL PROTECTED]> wrote: > > On Wednesday, June 4, 2003, at 02:40 PM, Wagner, David --- Senior > Programmer Analyst --- WGO wrote: > > > Jeff Westman wrote: > >> This may

Re: Scalars and Strict

2003-06-05 Thread Jeff Westman
y ($a, $b); > $a = $b = 'apple'; > > > --- Jeff Westman <[EMAIL PROTECTED]> wrote: > > This may sound trivial, but I am trying to declare > > and assign multiple > > scalars to the same variable in the same statement. > > This is what I have:

Scalars and Strict

2003-06-05 Thread Jeff Westman
This may sound trivial, but I am trying to declare and assign multiple scalars to the same variable in the same statement. This is what I have: #!/bin/perl -w $a = $b = "apple";# works use strict; my ($a = $b) = "apple"; # does not works my $a = my $b = "apple"; # works .. but loo

RE: Return Value Displayed to STDOUT

2003-05-31 Thread Jeff Westman
print "This is my second line"; -JW --- Bob Showalter <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > I am calling a function that returns a value, 0 or 1. The value (1) > > is being captured in my variable ($goodRC), but is -ALSO- bei

Return Value Displayed to STDOUT

2003-05-31 Thread Jeff Westman
I am calling a function that returns a value, 0 or 1. The value (1) is being captured in my variable ($goodRC), but is -ALSO- being displayed on STDOUT! <---snippet-> sub edHeader() { ... return 1; } $goodRC = editHeader(); print "more code, blah, blah. blah\n"

qr// -- huh?

2003-05-29 Thread Jeff Westman
Okay, this may sound pretty basic, but what is the qr// function used for? I rarely see it used. I've consulted perldoc perlre, and it still makes no sense. Could someone give a simple, practical example of this in use? Thanks! -Jeff __ Do you Yahoo!? Yahoo!

Re: Queue Suggestions?

2003-04-05 Thread Jeff Westman
Rob, I think you're right. I think the idea would be to have the server name next-to-be-processed append to the file, then the next step call a single separate script (start it if not already running, otherwise simpley "wait") that would lock the "control file", and this script would be the singl

Queue Suggestions?

2003-04-05 Thread Jeff Westman
I'm posed with a problem, looking for suggestions for possible resolution. I have a script that has many steps in it, including telnet & ftp sessions, database unloads, and other routines. This script will run on a server, accessing a remote server. This works fine. I will likely have several d

RE: Syntatic sugar maybe - no 'continue' command

2003-04-03 Thread Jeff Westman
It's a matter of style, I suppose, but seems kind of pointless to me. To each their own... But to answer your question, you can use a ';' on a line by itself, such as #!/usr/bin/perl -w $a = localtime(); if ($a =~ /Mar/) { print "March\n"; } elsif ($a =~ /Feb/) { print "February\n"; } el

RE: Sql statements in perl scripts

2003-04-02 Thread Jeff Westman
;here' document to access SQL*Plus? > HTH > > > Anthony (Tony) Esposito > > Senior Technical Consultant > > Inovis(tm), formerly Harbinger and Extricity > > 2425 N. Central Expressway, Suite 900 > > Richardson, TX 75080 > > (972) 643-3115 &g

Re: Sql statements in perl scripts

2003-04-02 Thread Jeff Westman
Hi, --- Jensen Kenneth B SrA AFPC/DPDMPQ <[EMAIL PROTECTED]> wrote: > I can't install the DBI modules to talk to our database, so I am trying to > run some commands from a system call. I am trying to pass some variables > retrieved from command line arguments to the sql statements. Here's my > pro

Re: use of "?" operator instead of "if"

2003-04-01 Thread Jeff Westman
--- Rob Dixon <[EMAIL PROTECTED]> wrote: > Bob Showalter wrote: > > Ravi Malghan wrote: > > > Hi: I have this statement which checks for existence > > > of the $VAL variable and performs certain actions > > > > > > if($VAL){ > > > $VAL = "$VAL:$expr"; } > > > else { > > > $VAL = "$expr"; } > >

Re: use of "?" operator instead of "if"

2003-04-01 Thread Jeff Westman
It's called the ternary operator, and works like this: $VAL ? $VAL = "$VAL:$expr" : $VAL = "$expr"; IF_EXPR ? THEN_EXPR : ELSE_EXPR Depending on context of how you are using it, I like to put the enter statement in parens as in: ( ternary_statement ) -Jeff --- Ravi Malghan <[EMAIL PROTECTED]>

RE: cobol -> perl ??

2003-03-28 Thread Jeff Westman
David, Thanks, I was just now finding out the same thing (architecture is 2 bytes for PIC S9(1) through PIC S9(5). Much thanks! -Jeff --- "Wagner, David --- Senior Programmer Analyst --- WGO" <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > Hi, > > >

cobol -> perl ??

2003-03-28 Thread Jeff Westman
Hi, I've got some files, that were written with a COBOL program, so I have fields that have been created with COMP (binary) "picture" clauses. The problem is now I need to read this file into a perl program. Here's what I have: 05 RECORD-TYPEPIC X. 05 LOC-ID

Re: hello

2003-03-27 Thread Jeff Westman
An excellent starting point is the camel book, "Learning Perl", by Randal Schwartz & Tom Christiansen. Don't let the title fool you -- it's a solid reference too --- Todd <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I imagine you see emails like this frequently, but I am looking for so

RE: screen size question

2003-03-27 Thread Jeff Westman
Good info Peter. As a side note too, this group is about "beginners", or basic perl, or those things pertaining to perl that we all need help on every now and then. I don't think the focus is CGI programming per se, but perl in general. It's a great group, and I personally have benefited tremend

Re: screen size question

2003-03-27 Thread Jeff Westman
x27; to help with exactly what you are asking. Hope that helps. -Jeff --- Luinrandir Hernsen <[EMAIL PROTECTED]> wrote: > Ok i tried it... > do I have to parse the info or what? > or do I set it up in an if/ifels/else ? > sorry if I sound dumb, but i'm just learning perl.

Net::Telnet Oddity

2003-03-26 Thread Jeff Westman
Hi, I am using Net::Telnet to do some remote commands on a server, including running some Informix SQL calls. I can get ONE Informix call to work fine (SQL finishes fine, no error, back to Unix prompt), but then when I try to issue a second call, it does not want to execute it. What's weird is t

Why Am I Getting a Compile Error? -SOLUTION

2003-03-26 Thread Jeff Westman
Never mind (thanks) -- cockpit error. --- Jeff Westman <[EMAIL PROTECTED]> wrote: > Date: Wed, 26 Mar 2003 10:35:41 -0800 (PST) > From: Jeff Westman <[EMAIL PROTECTED]> > Subject: Why Am I Getting a Compile Error? > To: beginners <[EMAIL PROTECTED]> > > This

Why Am I Getting a Compile Error?

2003-03-26 Thread Jeff Westman
This doesn't make sense to me: line 128: @result = $t->cmd($runSQL); line 129: $ordCnt = trim($result[16]); sub trim($) { my $arg = shift; chomp($arg); $arg =~ s/^\s+//; $arg =~ s/\s+$//; return $arg; } $ perl -c conv.pl syntax error at conv.pl line 129, near "result["

RE: Simple perl program

2003-03-25 Thread Jeff Westman
Sounds like a class homework assignment to me ;-) > > what code do you have so far? or are you having trouble getting started ? > --- "Kipp, James" <[EMAIL PROTECTED]> wrote: > > > > I need a very simple command line perl program that takes two > > arguements, > > the frist being a filename

Re: A Solution to: Using Devel::ptkdb module

2003-03-24 Thread Jeff Westman
It may have something to with your OS then, because under Linux (suse 8.1) using tcsh, I got it to work fine with setenv PTKDB_CODE_FONT 9x12 --- deb <[EMAIL PROTECTED]> wrote: > I have found a solution. If I give PTKDB_CODE_FONT env variable a full > font name, instead of just "9x12", it happ

Re: Net::Telnet -- Checking File Exists -SOLUTION

2003-03-24 Thread Jeff Westman
Perseverance pays off. Solution to checking if a file exists is to store result in a variable before it gets converted: $result = sprintf("%s", $t->cmd("test -f $testFile && print 1 || print 0")); Note: None of the following worked: $result = ! $t->cmd( "test -f $testFile ; echo $?" ); $result

Re: Net::Telnet -- Checking File Exists

2003-03-24 Thread Jeff Westman
--- Jeff Westman <[EMAIL PROTECTED]> wrote: > > my $result = ! $t->cmd( "test -f $testFile ; echo $?" ); > > Doesnt work. (makes no difference) In my question below, I should state that it always returns '1' irregardless if the file exists or not

Re: Net::Telnet -- Checking File Exists

2003-03-24 Thread Jeff Westman
> my $result = ! $t->cmd( "test -f $testFile ; echo $?" ); Doesnt work. (makes no difference) --- "John W. Krahn" <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > > How do you check if a file exists on a remote server using Net::Tel

Re: Using Devel::ptkdb module

2003-03-24 Thread Jeff Westman
Have you tried exporting PTKDB_CODE_FONT ? --- deb <[EMAIL PROTECTED]> wrote: > I have been using the Devel::ptkdb module on SunOS, which is a really fine > tool. However, the text in the code pane is extremely small. perldoc > has a list of environment variables which can be used to manipulat

Net::Telnet -- Checking File Exists

2003-03-24 Thread Jeff Westman
How do you check if a file exists on a remote server using Net::Telnet ? I have tried: $testFile = "/tmp/noFileExistsHere"; $result = $t->cmd("test -f $testFile ; print $? "); $result = $t->cmd("test -f $testFile && print 1 || print 0"); $result = $t->cmd("if [ -f $testFile ] ;then print 1; els

RE: Help! Telnet-->FTP

2003-03-21 Thread Jeff Westman
Seems such a shame to have to call perl from the command line or (last resort), run FTP using the shell. Your explanation makes sense. What a pain! --- [EMAIL PROTECTED] wrote: > > > On Fri, 21 Mar 2003 12:29:06 -0800 (PST), Jef

Help! Telnet-->FTP

2003-03-21 Thread Jeff Westman
I need help! I am connecting to a remote server using Net::Telnet. I am then running some programs, which works fine. Now I need to send the results back to the local server that established the connection. #- start $t = new Net::Telnet (Input_Log => "__debug_log" ); ... print "Attempting

Hanging '(' in Net::Telnet ?

2003-03-21 Thread Jeff Westman
Seems whenever I issue a command to Net::Telnet, I get a left-paren '(' in the result set. Consider the following from a debug session: <> ... print "Executing 'date'\n"; @result = $t->cmd("date"); foreach (@result) { print; } $t->close && print "Connect

RE: Where to use 'use'

2003-03-12 Thread Jeff Westman
Even though it was 'used' inside subx. > > #!/usr/bin/perl -w > use strict; > > &suby(); > > sub subx{ > use Data::Dumper; > } > > sub suby{ > print Data::Dumper->Dump([EMAIL PROTECTED]); > } > _END__ > > José.

Where to use 'use'

2003-03-12 Thread Jeff Westman
Hello All, I have a trivial question. I have a perl script, with several sub-routines. In one of those routines, I currently have listed 'use Date::Calc'. So that package is therefore only available (and needed) in that one sub-routine. My question is, should all 'use' statements be placed at

RE: Production Mode: Warnings?!

2003-03-10 Thread Jeff Westman
Good info, and I appreciate all who've responded to my post. The reason for my inquiry had to do when I was testing and using the Date::Calc module. I was getting all kinds of warnings about certain variables (inside the package) not being initialized yet (warning in concatenation). I only got

Production Mode: Warnings?!

2003-03-10 Thread Jeff Westman
I'm just trying to get a general feeling here from the community. I have a script that I am getting ready to turn over in "production mode". I am using 'use strict' of course, and during my coding and testing, have enable warnings. Now that the code is ready to "go production", should I turn o

RE: Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
use a block instead of just a > statement like in the examples above. > > So it still does what you expect... and then adds some functionaly beyond > that. > > Rob > > > > -Original Message- > From: Jeff Westman [mailto:[EMAIL PROTECTED] > Sent: Thursday

RE: Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
tement like in the examples above. > > So it still does what you expect... and then adds some functionaly beyond > that. > > Rob > > > > -Original Message- > From: Jeff Westman [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 06, 2003 5:47 PM > To

RE: Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
gt; > So it still does what you expect... and then adds some functionaly beyond > that. > > Rob > > > > -Original Message- > From: Jeff Westman [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 06, 2003 5:47 PM > To: beginners > Subject: Someone DO

Re: Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
e used to leave or restart the block. See the perlsyn manpage for alternative strategies. My script failed because I was using 'last' inside a do-while construct. This is why I posted this. It is a statement NOT a loop structure. Jeff --- Jenda Krynic

Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
In other languages, such as C, there is little difference between a while() loop and a do-while() loop. The only difference of course being that that do-while() loop will always execute at least once (test after), while the while-loop does a test before Much to my amazement, do() in perl is

Re: rename() doesn't work

2003-03-05 Thread Jeff Westman
I've had problems using rename() with ActivePerl under Windoze as well ... --- "R. Joseph Newton" <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > Yes, I tried all that. (thanks) > > > > This is very odd... turns out that when I tried to d

Re: rename() doesn't work

2003-03-05 Thread Jeff Westman
really wasn't. I'm using some HP proprietary network mount. Go figure %-/ -Jeff --- "R. Joseph Newton" <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > Why doesn't my rename() work? It is returning a '1', meaning success (I > g

rename() doesn't work

2003-03-05 Thread Jeff Westman
Why doesn't my rename() work? It is returning a '1', meaning success (I get the "has been modified" message below. Yet when I list the files (ls), it shows the original file name and my tmp file name. The rename doesn't seem to work. Any ideas?! close(IN) or warn "cannot close fi

Re: isopen() ?

2003-03-03 Thread Jeff Westman
ng like open(IN, "< $myFile) && ($myFileNum = fileno(IN)) or die "open failed" Thoughts?? -Jeff > Jeff Westman wrote: > > Isn't there a perl function to test if a file is already open? I could > have > > sworn I used one called "

isopen() ?

2003-03-03 Thread Jeff Westman
Isn't there a perl function to test if a file is already open? I could have sworn I used one called "isopen()" or "ifopen()" -or- am I getting confused with a similar function in C? If there isn't such a function, how would one test if a file is already open? Jeff __

beginners@perl.org

2003-02-25 Thread Jeff Westman
Thanks. The telling story is ((print(1) and 1) and ('???', '???')); Perl seems to be looking for another operator when using 'and'. -Jeff --- Paul Johnson <[EMAIL PROTECTED]> wrote: > On Tue, Feb 25, 2003 at 12:21:49PM -0800, Jeff Westman wrote:

beginners@perl.org

2003-02-25 Thread Jeff Westman
Basic question on using '&&' vs 'and'. I see that '&&' has higher precedence than 'and', but why does print 1 && 1 && 0; print "\n"; print 1 and 1 and 0; print "\n"; return 0 1 I would have expected both statements to return 0. Thanks Jeff _

Re: Calling a Perl Script from Another Perl Script

2003-02-12 Thread Jeff Westman
--- Wiggins d'Anconia <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > This seems simple enough I have two separate, independent perl > scripts. > > I want to call one perl script from the other script. > > > > Sometimes it just is that simpl

Re: Calling a Perl Script from Another Perl Script

2003-02-12 Thread Jeff Westman
Good point, thanks for the info. That might be the choice I go with. --- simran <[EMAIL PROTECTED]> wrote: > If you just wanted to use the other script and not return, look > at "exec": > > % perldoc -f exec > > simran. > > On Thu, 2003-02-13 at 0

Calling a Perl Script from Another Perl Script

2003-02-12 Thread Jeff Westman
This seems simple enough I have two separate, independent perl scripts. I want to call one perl script from the other script. I know I can do this with a system call (or backticks). Is there a better way? If not, what is the preferred method? (I don't want to make one a sub routine of the

Re: Command Line Modules

2003-02-11 Thread Jeff Westman
--- Paul Johnson <[EMAIL PROTECTED]> wrote: > On Tue, Feb 11, 2003 at 09:45:32AM -0800, Jeff Westman wrote: > > > This seems simple enough, but I can't get it to work. > > > > I want to print out the cross-reference AND parsed version of a script. > I &g

Command Line Modules

2003-02-11 Thread Jeff Westman
This seems simple enough, but I can't get it to work. I want to print out the cross-reference AND parsed version of a script. I can only get one of the modules at a time to work -- not both. I have tried: perl -Mmodule=Xref,Deparse myscript.pl perl -MO=Xref,-MO=Deparse myscript.pl perl -m modul

Comparing Arrays

2003-02-10 Thread Jeff Westman
If I read 2 files into separate arrays, I *should* be able to compare the arrays, and therefore see if the files are the same or not. SO why doesn't this work? #--- begin code #!/usr/local/bin/perl -w $f1 = "eghpoli1"; $f2 = "eghpoli2"; open(F1, "$f1") or die "cannot open $f1: $!\n"; open(F2, "

Install Mod as NON-Root

2003-02-10 Thread Jeff Westman
How do you install a perl module to your home directory if you do not have root access ?? Thanks in advance, JW __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PR

RE: Missing " ; " ?

2003-02-07 Thread Jeff Westman
Bob- This was extremely useful. Thanks for the tips. Regards, Jeff --- Bob Showalter <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > I inherited this script, whose code is as follows: > > > > #!/usr/local/bin/perl -w > > ... > > # 'while

Missing " ; " ?

2003-02-07 Thread Jeff Westman
I inherited this script, whose code is as follows: #!/usr/local/bin/perl -w ... # 'while' starts on line 42 while (($app_key, $app_value) = each %app_file_count) { delete ($app_file_count{$app_key});e } What is the "hanging 'e' on line 43? It is not a subroutine call, and ther

Re: until/if and private array errors

2002-12-21 Thread Jeff Westman
Comments below... --- Al Lukaszewski <[EMAIL PROTECTED]> wrote: > Greetings, > > It seems my earlier post ['foreach' and error diagnosis] was not clear > enough for some people on list. I will therefore clarify what I am > trying to do and appeal for further assistance. > > I have a grammatical

RE: Read-Write Mode Not Working (update)

2002-12-17 Thread Jeff Westman
> > Yes, I am having the same problem. I don't write much scripts > > (I'm a newbie) > > but when I do, open() doesn't seem to work. I'm pretty sure > > it has to work > > on Windows, but... > > > > -- > > B

Read-Write Mode Not Working

2002-12-15 Thread Jeff Westman
Hi, I'm using ActivePerl 5.6.1. I am trying to update an existing file. According to perlfaq5.pod, I should be able to use: open(FH, "+< /path/name"); # open for update However, I this doesn't seem to update the file for me: #--(begin)-# #! perl -w $| = 1; $file =

Re: first row of database

2002-12-10 Thread Jeff Westman
If you are using Oracle 8.i or greater, you can do: select * from yourTable where rownum < 2 JW --- Robbie Staufer <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a way to refer to the first row of a database (row 0?) ? > > For example, the first row of my database contains header infor

Package Syntax

2002-12-09 Thread Jeff Westman
I usually see the last line in a package as 1; Does this force the package to compile without error? What does it do, and why don't all packages have it? Thanks JW __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http

<    1   2