pstree

2006-05-25 Thread mohd sharif
Hi, I am writing a perl cgi program to get the status on page of all process running on particluar m/c. And then perform some action on those process but these process should get displayed in pstree format in expand mode. Has anybody done the same effort? -Sharif

GnuPG again: problem with if statement evaluation

2006-05-25 Thread Jason Balicki
I'm back. This is a piece of code taken from a larger program. I'm trying to determine that the encryption succeded, but when I try to evaluate the code, it always evaluates false even though the encryption works and produces an encrypted file. Here's the specific bit I'm concerned with: if

Re: GnuPG again: problem with if statement evaluation

2006-05-25 Thread Anthony Ettinger
check $? or $! $gp-foo() or die $!; my $output = $gp-foo(); print return code: $?; see perldoc perlvar On 5/25/06, Jason Balicki [EMAIL PROTECTED] wrote: I'm back. This is a piece of code taken from a larger program. I'm trying to determine that the encryption succeded, but when I try

Re: GnuPG again: problem with if statement evaluation

2006-05-25 Thread Anthony Ettinger
ps...you're checking if it has a value, 256 (a typical error return code) would pass that test. On 5/25/06, Anthony Ettinger [EMAIL PROTECTED] wrote: check $? or $! $gp-foo() or die $!; my $output = $gp-foo(); print return code: $?; see perldoc perlvar On 5/25/06, Jason Balicki [EMAIL

split doubt

2006-05-25 Thread Saurabh Singhvi
Hi the format of split() defines that one can split a string into a fixed number of specifies strings. for eg ($login, $passwd, $remainder) = split(/:/, $_, 3); Now, the thing is, it splits on first 3 parts. Can i do the reverse?? as in instead of the output being the first 3 parts of split,

Re: split doubt

2006-05-25 Thread Chris Charley
- Original Message - From: Saurabh Singhvi [EMAIL PROTECTED] Newsgroups: perl.beginners To: Perl FAq beginners@perl.org Sent: Thursday, May 25, 2006 3:38 PM Subject: split doubt Hi the format of split() defines that one can split a string into a fixed number of specifies strings.

Re: split doubt

2006-05-25 Thread Joshua Colson
On Thu, 2006-05-25 at 19:38 +, Saurabh Singhvi wrote: Hi the format of split() defines that one can split a string into a fixed number of specifies strings. for eg ($login, $passwd, $remainder) = split(/:/, $_, 3); Now, the thing is, it splits on first 3 parts. Can i do the

Re: split doubt

2006-05-25 Thread Mr. Shawn H. Corey
On Thu, 2006-25-05 at 13:17 -0700, Joshua Colson wrote: On Thu, 2006-05-25 at 19:38 +, Saurabh Singhvi wrote: Hi the format of split() defines that one can split a string into a fixed number of specifies strings. for eg ($login, $passwd, $remainder) = split(/:/, $_, 3);

Re: split doubt

2006-05-25 Thread John W. Krahn
Saurabh Singhvi wrote: Hi Hello, the format of split() defines that one can split a string into a fixed number of specifies strings. for eg ($login, $passwd, $remainder) = split(/:/, $_, 3); Now, the thing is, it splits on first 3 parts. Can i do the reverse?? as in instead of the

Re: GnuPG again: problem with if statement evaluation

2006-05-25 Thread John W. Krahn
Jason Balicki wrote: This is a piece of code taken from a larger program. I'm trying to determine that the encryption succeded, but when I try to evaluate the code, it always evaluates false even though the encryption works and produces an encrypted file. Here's the specific bit I'm

Perl OS system equivalence or Perl scripts for UNIX-and-Windows

2006-05-25 Thread benbart
Hi all, I've inherited a bunch of scripts that am spending lots of time debugging and tracing, changing etc. Part of the task also is to have the same modified in some way so that I can use it for both UNIX and Windows. Lots of these scripts have system UNIX COMMAND on them which of course I

RE: Perl OS system equivalence or Perl scripts for UNIX-and-Windows

2006-05-25 Thread Timothy Johnson
Do you have control over the Windows box you will be using for these scripts, or are these for a general distribution? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, May 25, 2006 4:21 PM To: beginners@perl.org; [EMAIL PROTECTED] Subject: Perl OS

Work with first x number of elements in array

2006-05-25 Thread Keenan, Greg John (Greg)** CTR **
Hi, What is the best way to only work with the first x number of elements in an array? At the moment this script prints the entire contents of @lines for each element in @cfgs I would like to restrict this to the number of elements listed in the hash %numTapes for each element in @cfgs Any

Re: Work with first x number of elements in array

2006-05-25 Thread Joshua Colson
On Fri, 2006-05-26 at 09:45 +1000, Keenan, Greg John (Greg)** CTR ** wrote: --start-- use strict; use warnings; my $cfgDir = '/amanda/admin/etc/amanda'; my @cfgs = qw(Toaster MFG-UNIX SYS-UNIX Amanda-Daily); my %numTapes = ( $cfgs[0] = 6, $cfgs[1] = 5, $cfgs[2] = 5, $cfgs[3]

Re: Work with first x number of elements in array

2006-05-25 Thread John W. Krahn
Keenan, Greg John (Greg)** CTR ** wrote: Hi, Hello, What is the best way to only work with the first x number of elements in an array? At the moment this script prints the entire contents of @lines for each element in @cfgs I would like to restrict this to the number of elements

Re: Work with first x number of elements in array

2006-05-25 Thread John W. Krahn
Joshua Colson wrote: On Fri, 2006-05-26 at 09:45 +1000, Keenan, Greg John (Greg)** CTR ** wrote: my $cfg; foreach $cfg (@cfgs) { my $fileIn=$cfgDir/$cfg/tapelist; open (FILEIN, $fileIn) or die (Could not open $fileIn: $!); my @lines = reverse FILEIN; my $line; #foreach

Re: Perl OS system equivalence or Perl scripts for UNIX-and-Windows

2006-05-25 Thread Ricky Zhou
On 5/25/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Lots of these scripts have system UNIX COMMAND on them which of course I can't run on Windows. Can anyone suggest how to get around this? Or any white papers on how to do this? If you have sufficient access to the windows computers (and you

RE: Perl OS system equivalence or Perl scripts for UNIX-and-Windows

2006-05-25 Thread Timothy Johnson
-Original Message- From: Ricky Zhou [mailto:[EMAIL PROTECTED] Sent: Thursday, May 25, 2006 5:30 PM To: [EMAIL PROTECTED] Cc: beginners@perl.org; [EMAIL PROTECTED] Subject: Re: Perl OS system equivalence or Perl scripts for UNIX-and-Windows On 5/25/06, [EMAIL PROTECTED] [EMAIL

RE: Work with first x number of elements in array

2006-05-25 Thread Keenan, Greg John (Greg)** CTR **
Using an AoA: for my $cfg ( @cfgs ) { my $fileIn = $cfgDir/$cfg-[0]/tapelist; open FILEIN, '', $fileIn or die Could not open $fileIn: $!; print +( reverse FILEIN )[ -$cfg-[1] .. -1 ]; } Using a hash: for my $cfg ( keys %cfgs ) { my $fileIn = $cfgDir/$cfg/tapelist; open

Re: Perl OS system equivalence or Perl scripts for UNIX-and-Windows

2006-05-25 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi all, Hello, I've inherited a bunch of scripts that am spending lots of time debugging and tracing, changing etc. Part of the task also is to have the same modified in some way so that I can use it for both UNIX and Windows. Lots of these scripts have system

Re: Work with first x number of elements in array

2006-05-25 Thread John W. Krahn
John W. Krahn wrote: Keenan, Greg John (Greg)** CTR ** wrote: my $cfgDir = '/amanda/admin/etc/amanda'; my @cfgs = qw(Toaster MFG-UNIX SYS-UNIX Amanda-Daily); my %numTapes = ( $cfgs[0] = 6, $cfgs[1] = 5, $cfgs[2] = 5, $cfgs[3] = 1, ); Do you really need an array and a hash? If you

RE: Work with first x number of elements in array

2006-05-25 Thread Keenan, Greg John (Greg)** CTR **
Small correction: because of the hyphens those barewords need to be quoted. my @cfgs = ( [ Toaster= 6 ], [ 'MFG-UNIX' = 5 ], [ 'SYS-UNIX' = 5 ], [ 'Amanda-Daily' = 1 ], ); my %cfgs = ( Toaster= 6, 'MFG-UNIX' = 5, 'SYS-UNIX' = 5,

Help: Is there any way to get the name of the Window Server that the Perl script is currently running on?

2006-05-25 Thread Japerlh
Help: Is there any way to get the name of the Window Server that the Perl script is currently running on? Thanks. -- Besh wishes, Japerlh -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Is there any funny game that was written in Perl? Thanks.

2006-05-25 Thread Japerlh
Many thanks to all you guys. ... On 5/25/06, Paul Johnson [EMAIL PROTECTED] wrote: On Wed, May 24, 2006 at 05:18:46AM -0700, Leonid Grinberg wrote: What about frozen bubble? That was written in Perl? Really?

RE: Help: Is there any way to get the name of the Window Server that the Perl script is currently running on?

2006-05-25 Thread Toby Stuart
-Original Message- From: Japerlh [mailto:[EMAIL PROTECTED] Sent: Friday, 26 May 2006 11:21 AM To: beginners Subject: Help: Is there any way to get the name of the Window Server that the Perl script is currently running on? Help: Is there any way to get the name of the Window

RE: Help: Is there any way to get the name of the Window Server that the Perl script is currently running on?

2006-05-25 Thread Timothy Johnson
There is a COMPUTERNAME environment variable that will have this info. -Original Message- From: Japerlh [mailto:[EMAIL PROTECTED] Sent: Thursday, May 25, 2006 6:21 PM To: beginners Subject: Help: Is there any way to get the name of the Window Server that the Perl script is currently

Re: Work with first x number of elements in array

2006-05-25 Thread Paul Johnson
On Fri, May 26, 2006 at 10:35:41AM +1000, Keenan, Greg John (Greg)** CTR ** wrote: Using a hash: for my $cfg ( keys %cfgs ) { my $fileIn = $cfgDir/$cfg/tapelist; open FILEIN, '', $fileIn or die Could not open $fileIn: $!; print +( reverse FILEIN )[ -$cfg{$cfg} .. -1 ]; }

Re: pstree

2006-05-25 Thread mohd sharif
On 5/25/06, mohd sharif [EMAIL PROTECTED] wrote: Hi, I am writing a perl cgi program to get the status on page of all process running on particluar m/c. And then perform some action on those process but these process should get displayed in pstree format in expand mode. Has anybody done the