Re: hash access

2006-09-13 Thread John W. Krahn
Xavier Mas i Ramón wrote: > Hi all!, Hello, > I'm trying to create a sorted (ASCII) hash file but get all time a syntax > error in line "my $abreviatures{$clau} = 1;" at "$abreviatures{ <--". Sure > is an stupid mistake but I'm not able to see it even checking with my > "Learning Perl" book.

hash access

2006-09-13 Thread Xavier Mas i Ramón
Hi all!, I'm trying to create a sorted (ASCII) hash file but get all time a syntax error in line "my $abreviatures{$clau} = 1;" at "$abreviatures{ <--". Sure is an stupid mistake but I'm not able to see it even checking with my "Learning Perl" book. Pls, can someone tell me where is the synta

Re: Command line vs. cron

2006-09-13 Thread Mumia W.
On 09/13/2006 06:07 PM, James Marks wrote: What turned out to work — although I haven't figured out why yet — is to to use 'acx' rather than 'aux' and to include that within the single quotes as in: open PS, '-|', '/bin/ps acx' or die "Cannot open pipe from ps: $!"; The above line results i

Re: Command line vs. cron

2006-09-13 Thread Igor Sutton
There's some reason to not use Proc::ProcessTable? It is really easy to use, and doesnt' relies on environment variables to be used. -- Igor Sutton Lopes t: +55 51 9627.0779 e: [EMAIL PROTECTED]

Re: Command line vs. cron

2006-09-13 Thread James Marks
On Sep 13, 2006, at 3:50 PM, John W. Krahn wrote: James Marks wrote: If I've correctly interpreted your suggested changes, the script now reads: -- SCRIPT -- #!/usr/bin/perl use warnings; use strict; my $log_file = '/home/james/httpsd_mysqld.log'; open FILE_OUT, ">> $log_

[Typofix] Re: Copying Hashes

2006-09-13 Thread D. Bolliger
D. Bolliger am Donnerstag, 14. September 2006 00:50: > #!/usr/bin/perl > > use strict; > use warnings; Obviously, this part occurs once too much, sorry :-( Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Copying Hashes

2006-09-13 Thread D. Bolliger
Hardly Armchair am Donnerstag, 14. September 2006 00:00: > [EMAIL PROTECTED] wrote: > > There is something you're not telling us about the contents of these > > hashes. > > Sorry, %p_mod looks like this: [...see in script below] > > My best guess (since you make us guess) is that you're looking for

Re: Command line vs. cron

2006-09-13 Thread John W. Krahn
James Marks wrote: > > If I've correctly interpreted your suggested changes, the script now > reads: > > -- SCRIPT -- > > #!/usr/bin/perl > > use warnings; > use strict; > > my $log_file = '/home/james/httpsd_mysqld.log'; > > open FILE_OUT, ">> $log_file" > or die "Cannot

Re: Re: Copying Hashes

2006-09-13 Thread Tom Phoenix
On 9/13/06, Hardly Armchair <[EMAIL PROTECTED]> wrote: > My best guess (since you make us guess) is that you're looking for a > deep copy because the values of %p_mod are actually references. I was unaware that this made a difference, thus the insufficient information. How do I proceed? Rand

Re: Copying Hashes

2006-09-13 Thread Hardly Armchair
[EMAIL PROTECTED] wrote: There is something you're not telling us about the contents of these hashes. Sorry, %p_mod looks like this: %p_mod = { 'A' => { 'fingers' => { '4' => 'ABSFMQS', '5' => 'SMTFQNL'

Re: Copying Hashes

2006-09-13 Thread lawrence
> Sorry for the bonehead question, but I have a hash called %p_mod. I > want to make a copy of it and edit the copy so that %p_mod stays the same. > > Currently, I'm creating %p_mod, writing > > %custom = %p_mod; > > to make a copy of %p_mod in %custom and then doing a bunch of stuff to > %c

Copying Hashes

2006-09-13 Thread Hardly Armchair
Sorry for the bonehead question, but I have a hash called %p_mod. I want to make a copy of it and edit the copy so that %p_mod stays the same. Currently, I'm creating %p_mod, writing %custom = %p_mod; to make a copy of %p_mod in %custom and then doing a bunch of stuff to %custom. However, w

Re: Command line vs. cron

2006-09-13 Thread James Marks
(snip) Here's the script: #!/usr/bin/perl use warnings; use strict; my $log_file = '/home/james/code/cron_code/httpsd_mysqld_log_file'; open FILE_OUT, ">> $log_file" or die "Cannot open log file: $!"; select FILE_OUT; (my $month, my $day, my $year, my $hour, my $minute, my $second) = (l

Re: Command line vs. cron

2006-09-13 Thread James Marks
On Sep 13, 2006, at 1:01 AM, Travis Thornhill wrote: I was just looking into the %ENV hash in my trusty Programming Perl book and found this interesting note on p. 661: "Note that processes running as crontab(5) entries inherit a particularly impoverished set of environment variables. (

Re: about map usage

2006-09-13 Thread Igor Sutton
my %hash = map { $_, 1 } @array; What is the usage of 1 in this code? When you have any kind of doubt about a Perl structure, you can use Data::Dumper: use Data::Dumper; my %hash = map { $_, 1 } @array; print Dumper \%hash; Try it! -- Igor Sutton Lopes t: +55 51 9627.0779 e: [EMAIL PROTE

Re: about map usage

2006-09-13 Thread jeffhua
Hello, I'd like to give you a good article for the wonderful introduce for perl's map,sort and grep.See here: http://web.archive.org/web/20041123005900/http://www.raycosoft.com/rayco/support/perl_tutor.html Hope it's useful. -jeff -Original Message- From: [EMAIL PROTECTED] To: begi

Re: about map usage

2006-09-13 Thread Rob Coops
What this does is creating a hash that looks like this: %hash { $array[0] => 1, $array[1] => 1, $array[2] => 1, $array[3] => 1, ect. } It is a (posibly the quickest way) of changing a array into a hash. Hope it helps. On 9/13/06, chen li <[EMAIL PROTECTED]>

about map usage

2006-09-13 Thread chen li
Hi all, In perlfaq4.pod I see one line: my %hash = map { $_, 1 } @array; What is the usage of 1 in this code? Thanks, Li __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsub

Re: NetSSH

2006-09-13 Thread Mathew Snyder
Kaushal Shriyan wrote: > On 9/13/06, Lee Goddard <[EMAIL PROTECTED]> wrote: >> > I am getting the below error >> > >> > C:\perlsc>perl sshperl1.pl >> > Can't locate Net/SSH/Perl.pm in @INC (@INC contains: >> > c:/Perl/lib c:/Perl/site/li b .) at sshperl1.pl line 1. >> > BEGIN failed--compilation ab

Re: NetSSH

2006-09-13 Thread Kaushal Shriyan
On 9/13/06, Lee Goddard <[EMAIL PROTECTED]> wrote: > I am getting the below error > > C:\perlsc>perl sshperl1.pl > Can't locate Net/SSH/Perl.pm in @INC (@INC contains: > c:/Perl/lib c:/Perl/site/li b .) at sshperl1.pl line 1. > BEGIN failed--compilation aborted at sshperl1.pl line 1. You need to

NetSSH

2006-09-13 Thread Kaushal Shriyan
Hi ALL My sshperl1.pl file contains the below use Net::SSH::Perl; my $ssh = Net::SSH::Perl->new($tweb33.abc.test.com); $ssh->login($user, $pass);: my($stdout, $stderr, $exit) = $ssh->cmd($cmd); I am getting the below error this is the error C:\perlsc>perl sshperl1.pl Can't locate Net/

Re: Parse Help

2006-09-13 Thread Rob Dixon
John W. Krahn wrote: John W. Krahn wrote: $ perl -le' my $text = q![20060911 14:47:11]p_var1= KQt=1 HZZ=2: 83,68//p_var2= KQt=1 HZZ=4: 77,57,52,52//p_var3=<543210987> KQt=1 HZZ=9: 52,54,48,52,50,57,49,56,50//p_var4=<001> KQt=1 HZZ=3: 48,48,49//p_var5=<12345> KQt=1 HZZ=5: 49,50,51,52,53//p_var6=

Re: Command line vs. cron

2006-09-13 Thread Travis Thornhill
I was just looking into the %ENV hash in my trusty Programming Perl book and found this interesting note on p. 661: "Note that processes running as crontab(5) entries inherit a particularly impoverished set of environment variables. (If your program runs fine from the command line but not u

Re: Command line vs. cron

2006-09-13 Thread James Marks
On Sep 13, 2006, at 12:29 AM, John W. Krahn wrote: #!/usr/bin/perl use warnings; use strict; my $log_file = '/home/james/code/cron_code/httpsd_mysqld_log_file'; open FILE_OUT, ">> $log_file" or die "Cannot open log file: $!"; select FILE_OUT; (my $month, my $day, my $year, my $hour, my

Re: Command line vs. cron

2006-09-13 Thread John W. Krahn
James Marks wrote: > Hi folks, Hello, > I don't know if this is a Perl or UNIX problem and I'm hoping you can > help me figure that out. > > I wrote a script that checks to see if the httpsd and mysqld processes > are running on my server and to log the results of those tests. > > When I run th