Getopt::Long

2010-06-16 Thread Unknown User
I have the following code: GetOptions( "n|name=s" => \$name, "a|age=i" => \$age, "s|sex=s" => \$sex, ) || die "Bad options\n";; What i expected this code to do is to die if a bad option was given, say -s without an arguement, as in ./myprog -n name -s -a 20 However, it d

Re: Fork ssh

2010-06-16 Thread John W. Krahn
Unknown User wrote: Hi Hello, I wrote the following script to fork ssh processes with perl and Parallel::ForkManager: #!/usr/local/bin/perl -w use strict; my @cmd = "@ARGV"; Why would you use an array to store a single scalar value? Either: my $cmd = "@ARGV"; Or: my @cmd = @ARGV; u

Re: Fork ssh

2010-06-16 Thread Jeff Pang
2010/6/17 Unknown User : > > > This works pretty well, but Since There is More than One Way to DO it, > i wonder if anyone has another version that does not use fork? > Just use the right one for you. Instead of processes, the Threads and Coro may also do that well. Regards. -- To unsubscribe,

Fork ssh

2010-06-16 Thread Unknown User
Hi I wrote the following script to fork ssh processes with perl and Parallel::ForkManager: #!/usr/local/bin/perl -w use strict; my @cmd = "@ARGV"; use Parallel::ForkManager; my @nodes; open(NODE,") { chomp; push(@nodes,$_); } my $pm = new Parallel::ForkManager(10); # Ma

Re: Problems constructing a hash of hashes

2010-06-16 Thread Steve Bertrand
On 2010.06.16 19:36, Uri Guttman wrote: >> "CO" == Chas Owens writes: > CO> Or the online versions: > as a perl teacher i respect says, use the local docs as they are always > there ...point well taken. I will personally follow this method from now on. If any poster doesn't initially und

Re: Problems constructing a hash of hashes

2010-06-16 Thread Uri Guttman
> "CO" == Chas Owens writes: CO> On Wed, Jun 16, 2010 at 18:29, Uri Guttman wrote: CO> snip >> for more on hashes of hashes read perldoc perlreftut, perllol and >> perldsc. CO> snip CO> Or the online versions: CO> http://perldoc.perl.org/perlreftut.html CO> http://perldoc.p

Re: Error check help

2010-06-16 Thread Aravind Venkatesan
Thanks a lot for your suggestions, it helped me a lot!! :) Aravind On 06/16/2010 05:14 PM, Jim Gibson wrote: At 4:30 PM +0200 6/16/10, Aravind Venkatesan wrote: Hi everyone, I have written a code that takes in two files (containing a set of terms) as arguments eg: testfile1 CCO:P056

Re: Problems constructing a hash of hashes

2010-06-16 Thread Chas. Owens
On Wed, Jun 16, 2010 at 18:29, Uri Guttman wrote: snip > for more on hashes of hashes read perldoc perlreftut, perllol and > perldsc. snip Or the online versions: http://perldoc.perl.org/perlreftut.html http://perldoc.perl.org/perllol.html http://perldoc.perl.org/perldsc.html -- Chas. Owens wo

Re: Problems constructing a hash of hashes

2010-06-16 Thread Uri Guttman
> "GJ" == Greg J writes: GJ> Hi everyone, GJ> I am new to Perl and I am having some trouble working with hashes of hashes. GJ> I am trying to write a simple Markov Chain text generator and thought GJ> it might be a good idea to keep track of state transitions in a hash. GJ> Here

Re: Problems constructing a hash of hashes

2010-06-16 Thread Chas. Owens
On Wed, Jun 16, 2010 at 18:02, Greg J wrote: snip > sub InsertWord > { >   my( $state, $next ) = shift @_; snip This is your big problem. You need to say my ($state, $next) = @_; or my $state = shift; my $next = shift; snip >   if( $StateTable{$state} ) >   { > if( $StateTable{$state}{

Re: Problems constructing a hash of hashes

2010-06-16 Thread Shawn H Corey
On 10-06-16 06:02 PM, Greg J wrote: Hi everyone, I am new to Perl and I am having some trouble working with hashes of hashes. I am trying to write a simple Markov Chain text generator and thought it might be a good idea to keep track of state transitions in a hash. Here is some of the code I h

Problems constructing a hash of hashes

2010-06-16 Thread Greg J
Hi everyone, I am new to Perl and I am having some trouble working with hashes of hashes. I am trying to write a simple Markov Chain text generator and thought it might be a good idea to keep track of state transitions in a hash. Here is some of the code I have.. ===

Re: Error check help

2010-06-16 Thread Jim Gibson
At 4:30 PM +0200 6/16/10, Aravind Venkatesan wrote: Hi everyone, I have written a code that takes in two files (containing a set of terms) as arguments eg: testfile1 CCO:P056cell cycle CCO:U002cell-cycle process CCO:P308cell cycle process CCO:P004regulation of

Re: Error check help

2010-06-16 Thread Chas. Owens
On Wed, Jun 16, 2010 at 10:30, Aravind Venkatesan wrote: > Hi everyone, snip snip > # Takes in first argument > my $input_file1 = $_; > open (FILEONE, $input_file1); > > my @list1 = ; snip This does not work. $_ does not hold the first arguent. You mean to say my $input_file1 = shift; or my

Error check help

2010-06-16 Thread Aravind Venkatesan
Hi everyone, I have written a code that takes in two files (containing a set of terms) as arguments eg: testfile1 CCO:P056cell cycle CCO:U002cell-cycle process CCO:P308cell cycle process CCO:P004regulation of progression through cell cycle CCO:P005cell

Re: Edit large data file

2010-06-16 Thread Robert Citek
On Tue, Jun 15, 2010 at 1:50 PM, mrwawa wrote: > Is this possible, and if so how can I do it? Can you give an example? For example, using colons instead of tabs, if the input looks like this: A:BC:D then you want it to look like this: A:B:C:D Is that right? Regards, - Robert -- To unsubsc

Re: Multi page form - cgi

2010-06-16 Thread Steve Bertrand
On 2010.06.16 07:12, Shlomi Fish wrote: > On Wednesday 16 Jun 2010 01:58:19 Herb wrote: >> My goal is to create a form that has multiple pages with a few >> questions per page so that visitors aren’t dropped into a large single >> page form that they feel is too daunting and therefore don’t fill i

Re: What is the best way to parse a GPX (XML) file

2010-06-16 Thread robert Key
On 16/06/2010 14:29, Owen wrote: Hi I would like to parse GPX file (XML) and insert certain data items into a MySQL database. There are mulitude of XML modules which can be used. These modules all build a hash from the data. Is this done because it is easy to find the the data simply using th

Re: What is the best way to parse a GPX (XML) file

2010-06-16 Thread Shlomi Fish
On Wednesday 16 Jun 2010 15:29:33 Owen wrote: > > Hi I would like to parse GPX file (XML) and insert certain data items > > into a MySQL database. There are mulitude of XML modules which can be > > used. > > > > These modules all build a hash from the data. Is this done because it > > is > > easy

Re: What is the best way to parse a GPX (XML) file

2010-06-16 Thread Owen
> Hi I would like to parse GPX file (XML) and insert certain data items > into a MySQL database. There are mulitude of XML modules which can be > used. > > These modules all build a hash from the data. Is this done because it > is > easy to find the the data simply using the key? > > I don't mind

Re: What is the best way to parse a GPX (XML) file

2010-06-16 Thread Jeff Pang
2010/6/16 robert Key : > Hi I would like to parse  GPX file (XML) and insert certain data items into > a MySQL database. There are mulitude of XML modules which can be used. > > These modules all build a hash from the data. Is this done because it is > easy to find the the data simply using the key

What is the best way to parse a GPX (XML) file

2010-06-16 Thread robert Key
Hi I would like to parse GPX file (XML) and insert certain data items into a MySQL database. There are mulitude of XML modules which can be used. These modules all build a hash from the data. Is this done because it is easy to find the the data simply using the key? I don't mind writing my o

Re: Edit large data file

2010-06-16 Thread Robert Wohlfarth
On Wed, Jun 16, 2010 at 5:19 AM, John W. Krahn wrote: > mrwawa wrote: > >> I have a data file (roughly 13 GB) that consists of tab delimited >> entries. Because of its large size, I am reading the data in one line >> at a time. For some of the rows, a tab is missing between columns 2 >> and 3 a

Re: Multi page form - cgi

2010-06-16 Thread Shlomi Fish
On Wednesday 16 Jun 2010 01:58:19 Herb wrote: > Hi All, > > I’m relatively new to perl and cgi and have a question about putting > together a multi page form. > > My goal is to create a form that has multiple pages with a few > questions per page so that visitors aren’t dropped into a large singl

Re: Edit large data file

2010-06-16 Thread John W. Krahn
mrwawa wrote: Hi all, Hello, I posted earlier, but it has not been listed yet. I have a second question about editing a large data file. I have a data file (roughly 13 GB) that consists of tab delimited entries. Because of its large size, I am reading the data in one line at a time. For s

Re: Parse numeric string

2010-06-16 Thread John W. Krahn
Gopal Karunakar wrote: You can try using sprintf function to treat the numeric as string.. It already is a string so you don't have to use sprintf. John -- Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite

Re: Parse numeric string

2010-06-16 Thread John W. Krahn
mrwawa wrote: Hi all, Hello, I am new to Perl and am trying to do the following. I have a dataset file with the following example structure. ACRU 12 34 QUAL 28 90 QURU3345 . . . . . QUVE29 88 As you can see, line 3 only contains on 2 columns. "3345" is missing a tab. I

Re: Parse numeric string

2010-06-16 Thread Gopal Karunakar
You can try using sprintf function to treat the numeric as string.. On 15 June 2010 21:10, mrwawa wrote: > Hi all, > > I am new to Perl and am trying to do the following. I have a dataset > file with the following example structure. > > ACRU 12 34 > QUAL 28 90 > QURU3345 > . . . .

Multi page form - cgi

2010-06-16 Thread Herb
Hi All, I’m relatively new to perl and cgi and have a question about putting together a multi page form. My goal is to create a form that has multiple pages with a few questions per page so that visitors aren’t dropped into a large single page form that they feel is too daunting and therefore don

Edit large data file

2010-06-16 Thread mrwawa
Hi all, I posted earlier, but it has not been listed yet. I have a second question about editing a large data file. I have a data file (roughly 13 GB) that consists of tab delimited entries. Because of its large size, I am reading the data in one line at a time. For some of the rows, a tab is

Parse numeric string

2010-06-16 Thread mrwawa
Hi all, I am new to Perl and am trying to do the following. I have a dataset file with the following example structure. ACRU 12 34 QUAL 28 90 QURU3345 . . . . . QUVE29 88 As you can see, line 3 only contains on 2 columns. "3345" is missing a tab. I have written code to loop