Re: sorting?

2006-05-29 Thread Sumo Wrestler (or just ate too much)
Beast wrote: Hi, I have some rather big chunk of data, returned from ldap server. The format is simple: "Displa name" <[EMAIL PROTECTED]> Simply displying data "as is" is simple, but how do I sorted by "display name"? pls note that "display name" contains space and might not unique so I ca

Re: sorting?

2006-05-29 Thread Wijaya Edward
- Original Message - From: Beast <[EMAIL PROTECTED]> Date: Wednesday, May 31, 2006 1:59 pm Subject: sorting? > Hi, > > I have some rather big chunk of data, returned from ldap server. > The > format is simple: > "Displa name" <[EMAIL PROTECTED]> > > Simply displying data "as is" is

sorting?

2006-05-29 Thread Beast
Hi, I have some rather big chunk of data, returned from ldap server. The format is simple: "Displa name" <[EMAIL PROTECTED]> Simply displying data "as is" is simple, but how do I sorted by "display name"? pls note that "display name" contains space and might not unique so I can't put it on

Using Net::SSH::Perl to execute a set of commands

2006-05-29 Thread Kelvin Wu
Hi, I was trying to use Net::SSH::Perl to log into a remote box and execute a program with pre-defined commands, something like: #!/usr/bin/perl use strict; use Net::SSH::Perl; my $ssh = Net::SSH::Perl->new("ip", debug => 0); $ssh->login("name", "password"); my ($return) = $ssh->cmd("minicom

Re: accessor problem in OO

2006-05-29 Thread Chad Perrin
On Mon, May 29, 2006 at 06:39:57PM -0700, chen li wrote: > > > --- Chad Perrin <[EMAIL PROTECTED]> wrote: > > > On Mon, May 29, 2006 at 01:17:52PM -0700, chen li > > wrote: > > > Sorry but what I mean is "Beginning Perl" from > > > http://learn.perl.org/library/beginning_perl/ > > > > > > And

Re: accessor problem in OO

2006-05-29 Thread chen li
--- Chad Perrin <[EMAIL PROTECTED]> wrote: > On Mon, May 29, 2006 at 01:17:52PM -0700, chen li > wrote: > > Sorry but what I mean is "Beginning Perl" from > > http://learn.perl.org/library/beginning_perl/ > > > > And BTW I have a hard copy of "Learning Perl" by > > myself. > > I had a sneak

Re: accessor problem in OO

2006-05-29 Thread Chad Perrin
On Mon, May 29, 2006 at 01:17:52PM -0700, chen li wrote: > Sorry but what I mean is "Beginning Perl" from > http://learn.perl.org/library/beginning_perl/ > > And BTW I have a hard copy of "Learning Perl" by > myself. I had a sneaking suspicion you weren't talking about the Llama book, especial

Re: substitute/regex etc

2006-05-29 Thread Dan
""John W. Krahn"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > John W. Krahn wrote: >> Dan wrote: >>>how can i substitute, or remove anything that's not an alphanumerical >>>character in a string? >> >> s/[[:alnum:]]+//g; > > Sorry, that should be: > > s/[^[:alnum:]]+//g; > > > Jo

Re: accessor problem in OO

2006-05-29 Thread chen li
Sorry but what I mean is "Beginning Perl" from http://learn.perl.org/library/beginning_perl/ And BTW I have a hard copy of "Learning Perl" by myself. Li --- "Randal L. Schwartz" wrote: > > "chen" == chen li <[EMAIL PROTECTED]> writes: > > chen> I recently read chapter 11 about OOP fr

Re: monitoring file like tail -f in perl

2006-05-29 Thread Xavier Noria
On May 29, 2006, at 18:19, Ken Foskey wrote: I want to monitor a daemon's logs that updates randomly through the day and night. Is there a way to open the log file and read the new records as they come in the same way as tail -f does? Sure, with File::Tail for example. -- fxn -- To un

Re: monitoring file like tail -f in perl

2006-05-29 Thread JupiterHost.Net
Ken Foskey wrote: I want to monitor a daemon's logs that updates randomly through the day and night. Is there a way to open the log file and read the new records as they come in the same way as tail -f does? Sure, look on cpan for File::Tail::App and File::Tail -- To unsubscribe, e-mail: [E

monitoring file like tail -f in perl

2006-05-29 Thread Ken Foskey
I want to monitor a daemon's logs that updates randomly through the day and night. Is there a way to open the log file and read the new records as they come in the same way as tail -f does? Thanks Ken -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECT

Re: accessor problem in OO

2006-05-29 Thread Randal L. Schwartz
> "chen" == chen li <[EMAIL PROTECTED]> writes: chen> I recently read chapter 11 about OOP from the online chen> book "learning perl". Here are some example codes chen> from chapeter 11: There is no "online book" named "Learning Perl". If you see it online, please report the copyright vio

Re: map array to hash

2006-05-29 Thread John Ackley
Jenda Krynicky wrote: From: John Ackley <[EMAIL PROTECTED]> there is more than one way to do it is there an easier way to do this map: my $index = 0; while( my @a = $SQL->fetchrow_array) { my %a = map { $fieldnames[$index++] => $_ } @a; print "$_ => $a{$_}\n" for (keys %a);

Re: map array to hash

2006-05-29 Thread Paul Johnson
On Mon, May 29, 2006 at 09:16:00AM -0400, John Ackley wrote: > there is more than one way to do it > is there an easier way to do this map: > > my $index = 0; > while( my @a = $SQL->fetchrow_array) { >my %a = map { $fieldnames[$index++] => $_ } @a; my %a; @[EMAIL PROTECTED] = @a;

map array to hash

2006-05-29 Thread John Ackley
there is more than one way to do it is there an easier way to do this map: my $index = 0; while( my @a = $SQL->fetchrow_array) { my %a = map { $fieldnames[$index++] => $_ } @a; print "$_ => $a{$_}\n" for (keys %a); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

Re: export script problem

2006-05-29 Thread Gomez, Juan
...I agree perhaps I could make a small script that could do what he wants Is what you want right? -Original Message- From: "Chad Perrin" <[EMAIL PROTECTED]> Sent: 05/26/2006 11:45:39 AM To: "beginners@perl.org" Subject: Re: export script problem On Fri, May 26,

Re: accessor problem in OO

2006-05-29 Thread chen li
Hi Peter, Thank you very much, Li --- Peter Cornelius <[EMAIL PROTECTED]> wrote: > > On May 27, 2006, at 3:56 PM, chen li wrote: > > > > Based on what I learn the regular method to defer > a > > hash reference to get specific value takes this > > format: > > > > $ref_hash->{key1} > > > > bu

Re: Sum problem

2006-05-29 Thread Chandru
Hey problem with your for loop #!/usr/bin/perl -w while (<>) { chomp; ($name,$value)=split(/\t/); $ha{$name}+=$value; } foreach $i(sort keys %ha) { print$i." ".$ha{$i}."\n"; } - Chandru Andrej Kastrin wrote: Dear Perl users, I have 2 columns, tab separated file which looks like

RE: PERL-CGI to pass a file to multiple server

2006-05-29 Thread Thomas Bätzler
I BioKid asked: > We have three web servers (say a,b,c) that take a similar > file (xyz.txt) and gives the results. > Now, we want to make a meta-server with three check-boxes and > only one input form. > The purpose is to accept a single file and run the 'checked' >

Re: Sum problem

2006-05-29 Thread Mohammed Shameer
Hi, You should always have use strict; use warnings; in your perl code. u misspelled the hash %values in the for loop On Monday 29 May 2006 16:47, Andrej Kastrin wrote: > foreach $w (sort by_number keys %values) { >     print "$w\t$value{$w}\n" > } Shameer -- -- To unsubscribe, e-mail: [

Sum problem

2006-05-29 Thread Andrej Kastrin
Dear Perl users, I have 2 columns, tab separated file which looks like A 4 B 3 C 1 A 3 B 3 First column refers to name and second to value. I have to calculate total score on each 'name'; in my case: A 7 B 6 C 1 Here is the code; but it doesn't work. # whi

PERL-CGI to pass a file to multiple server

2006-05-29 Thread I BioKid
Hi all, We have three web servers (say a,b,c) that take a similar file (xyz.txt) and gives the results. Now, we want to make a meta-server with three check-boxes and only one input form. The purpose is to accept a single file and run the 'checked' server and provide the results as two separate l