Re: Array indexing question

2008-07-10 Thread Stephen Kratzer
by whitespace, not necessarily a single space. Try passing the pattern '\w+' to split. Something like this: #!/usr/bin/perl use strict; use warnings; open (LS, "w|") or die "can't open w: $!"; ; ; while () { print ((split)[4], "\n"); } Stephen Kratzer Network Engineer CTI Networks, Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Array indexing question

2008-07-10 Thread Stephen Kratzer
On Thursday 10 July 2008 10:33:31 Jay Savage wrote: > On Thu, Jul 10, 2008 at 8:48 AM, Stephen Kratzer <[EMAIL PROTECTED]> wrote: > > Anirban, > > > > The output of 'w' is delimited by whitespace, not necessarily a single > > space. Try passing the

Re: Command Splice()

2007-06-05 Thread Stephen Kratzer
On Tuesday 05 June 2007 09:38:51 Xu, Lizhe wrote: > Hi All, > =20 > The example given for splice function in the perldoc shows > sub aeq { > ... > my(@a)=3D splice (@_, 0, shift); > ... > } > I am confused about what the splice command does with the shift command = > and what the result of the c

Re: installing DBD::mysql

2007-07-12 Thread Stephen Kratzer
On Wednesday 11 July 2007 07:31:30 Octavian Rasnita wrote: > Hi, > > I am trying to install DBD::mysql and I see that it tries to connect to the > server using the socket > /var/lib/mysql/mysql.sock > > This is because another version of MySQL was installed on the server, and I > have installed ano

Re: Get names of files ONLY using module Net::SFTP::Foreign

2007-08-24 Thread Stephen Kratzer
On Friday 24 August 2007 08:57:26 Marian Bednar wrote: > Hi all, > > > I am a newbie in this forum and Perl too ;-) > > I am trying writing script transfering files using module > Net::SFTP::Foreign. > > I need to retrieve from remote directory only names of files (not > directories, links,etc.). >

Re: Get names of files ONLY using module Net::SFTP::Foreign

2007-08-27 Thread Stephen Kratzer
On Friday 24 August 2007 21:00:37 John W. Krahn wrote: > Stephen Kratzer wrote: > > On Friday 24 August 2007 08:57:26 Marian Bednar wrote: > >> I am a newbie in this forum and Perl too ;-) > >> > >> I am trying writing script transfering files using module >

Re: Accumulating Column Total From a CSV for a Common Key Value

2007-08-28 Thread Stephen Kratzer
On Monday 27 August 2007 12:36:02 country wrote: > s2pe,CTI Production ,8455,21.7% > sybprd01,OMS,5326,13.7% > pctip01,CTI,5098,13.1% > lxsadr54,CTI,1742,4.5% > pipmp01,SSG-IPM,1742,4.5% > maestro,SSG-RAC-Maestro ,1020,2.6% > f2pa,"DB2DARI  ""stored procedures"" prod",836,2.1% > pomgp01,SSG-PMD-Ome

Re: Problem in comparing two files using compare.pm

2007-08-29 Thread Stephen Kratzer
On Wednesday 29 August 2007 00:43:52 [EMAIL PROTECTED] wrote: > Hi, > > Please find below my code to compare 2 files > "source.txt,destination.txt" in folder "seek" > > #!perl > > use File::Compare; > > if(Compare("source.txt","destination.txt")==0) > { > print "They're equal\n"; >

Re: code ref within a hash?

2007-10-19 Thread Stephen Kratzer
On Friday 19 October 2007 07:41:40 Beginner wrote: > Hi, > > In the script below I am trying my hand at using a code ref within a > hash. I want the key 'name' to contain a scalar value. It does but I > am not sure how to dereference it. > > Here is the output from the script at the moment. > > /da

Re: open and close a filehandle

2008-01-10 Thread Stephen Kratzer
t a typo, but "$my file" should be "my $file". Most importantly, the program is more complicated than it needs to be. A more concise and readable example might be something like: #!/usr/bin/perl open SUBSET1, ">", "subset1" or die "Cannot ope

Re: Why doesn't this work: trinary operator?

2008-01-11 Thread Stephen Kratzer
erator produces an assignable result, using assignments without parentheses will get you in trouble. For example, this: $a % 2 ? $a += 10 : $a += 2 Really means this: (($a % 2) ? ($a += 10) : $a) += 2 Rather than this: ($a % 2) ? ($a += 10) :

Re: Help in system function

2008-01-17 Thread Stephen Kratzer
On Thursday 17 January 2008 09:16:17 [EMAIL PROTECTED] wrote: > Hi All, > > > > I am executing following command in Perl script > > > > $vw=system("mk_view $view_name ETC"); > > if ($vw) > > { print "view created successfully\n"; > > } > > > > When I run this command, I am getting message "view c

Re: Debugger question

2008-02-15 Thread Stephen Kratzer
point which is activated only when the associated condition is true. To add a watchpoint, type 'w expr' in the debugger where expr is the expression which must be true in order for the watchpoint to be activated. In your case, type 'w $i == 10'. Stephen Kratzer Network Engineer

Re: Writing side of square

2008-05-05 Thread Stephen Kratzer
On Monday 05 May 2008 09:22:51 Rodrigo Tavares wrote: > Hello, > > I need create a square using a single number, but I don't know how to > create the sides. > > I have to create this: > > > * * > * * > > > My code is below : > > print "Enter with number:"; > chomp ($number = ); > > my @

Re: threads

2006-03-21 Thread Stephen Kratzer
I'm not too familiar with threads, but I'll give it a go. You're still executing the download() sub seventy times one after another rather than concurrently. The async function will created one new thread for the block following it. You might try a for loop which creates a new thread at each it

Re: New to Perl....

2006-03-28 Thread Stephen Kratzer
k and device monitoring tools, so there's really no reason for you to try to reinvent the wheel in two hours. Stephen Kratzer CTI Networks, Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://l

Re: Event Timer in Perl

2006-05-22 Thread Stephen Kratzer
broutine; } } sub timer_test { print "Testing...\n" } You'd need to modify the timer subroutine in order to pass arguments to the routine executed by it. Stephen Kratzer CTI Networks, Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: foreach loop

2006-07-21 Thread Stephen Kratzer
On Friday 21 July 2006 08:59, Sayed, Irfan (Irfan) wrote: > Hi, > > I am executing following code. > > foreach (@vob_repl_list) > > { > > print $_; > > `$MT chreplica -host puvob02 $_`; > > } > > but I am not getting the value of $_ in the command `$MT chreplica -host > puvob02 $_`; if I print the

Re: another error handling question

2006-07-21 Thread Stephen Kratzer
On Friday 21 July 2006 12:24, Jerry DuVal wrote: > Any way to catch a die message? I want to catch a die message from a sub > routine, log it, and continue with a different sub routine. > > > > Thanks in advance, > > > > Jerry You could call the subroutine from an eval block and check the value of

Re: STAT function; limit a log file.

2005-10-04 Thread Stephen Kratzer
Chances are that the file size will never equal exactly 500 bytes. You could use >= instead of eq, and it should work. Also, you don't have to close STDERR before reopening it, and in cases where you want to do numeric comparisons, use == instead of eq. Hope that helps a little. Also, it might

Re: Redirecting STDERR

2005-10-07 Thread Stephen Kratzer
Opening the filehandle STDERR to a file will not persist beyond termination of the script, nor will it affect other programs running at the same time as the script. It affects only the running script. STDERR of the shell is different from that of perl. On Friday 07 October 2005 16:56, Timothy J

Re: Help required about NET::TELNET

2005-12-05 Thread Stephen Kratzer
Mazhar, try: $telnet->waitfor(Match => '/login: $/i'); and $telnet->waitfor(Match => '/password: $/i'); Vishal, Right, you want to wait for the device to return something that will match the expression between the slashes. In that example, you'd be waiting for the device to return a login prom

Re: Problem with retrieving output from commands using net::telnet

2005-12-21 Thread Stephen Kratzer
Your regexes are probably not doing what you expect them to. You're using character classes, so it's waiting for the device to return a one character prompt that matches any one of the characters from the class. Try something like /password[: ]*$/i and something similar for other prompts. > All