RE: writing a package

2006-09-23 Thread Johnson, Reginald \(GTI\)
I made the changes that you advised use Test::More tests => 3; #BEGIN { $| = 1; print "1..3\n";} My error has changed slightly PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/1# No tests run! t/1dubious Tes

RE: CGI: How do I populate a form field based on the value entered in a different field

2006-09-23 Thread RICHARD FERNANDEZ
Ding! Ding! Ding! I finally got it!!! Not sure why this had me so stumped... In any case, thanks to all that responded. I appreciate all the help. richf -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: CGI: How do I populate a form field based on the value entered in a different field

2006-09-23 Thread RICHARD FERNANDEZ
Did you test it? It is my impression that CGI.pm works this way normally: if (param) { # Replace the parameter. my $temp = param('name'); if ($nmap{$temp}) { # param('name',$nmap{$temp}); # This also works. param(-name => 'name', -value

Re: selecting a part of a string

2006-09-23 Thread John W. Krahn
Rob Dixon wrote: > Adriano Allora wrote: >> >> $tex =~ s/^([^|]+).*/$1/o; > > Your regex is correct, but it doesn't do what you said you wanted! You're > substituting the entire string in $tex for just those characters up to > the first > pipe, but there's nothing in $tex - the data has be

Re: selecting a part of a string

2006-09-23 Thread Mumia W.
On 09/23/2006 07:07 PM, Rob Dixon wrote: [...] If you want to do what you said, and put everything up to the pipe into a variable (scalar $tex?) then /([^|]+)/; $tex = $1; [...] No, you should always only use the match variables after you've determined that the match was successful: /^(

Re: CGI: How do I populate a form field based on the value entered in a different field

2006-09-23 Thread Mumia W.
On 09/23/2006 01:21 PM, RICHARD FERNANDEZ wrote: Hi folks, I'm trying to create an HTML form that will refresh itself based on user input. In the POD for CGI it says that you can set the value of a named parameter by using something like: $query->param(-name=>'foo', -value=>'the value'); B

Re: CGI: How do I populate a form field based on the value entered in a different field

2006-09-23 Thread D. Bolliger
RICHARD FERNANDEZ am Sunday, 24. September 2006 02:15: > > $query->param(-name=>'foo', -value=>'the value'); > > Make that line $query->param(-name=>'foo', -value=>"$the_value"); > > Then somwhere at the start where you get the variables; > > my $name = $query->param('name')||''; > > if ($name =~/

RE: CGI: How do I populate a form field based on the value entered in a different field

2006-09-23 Thread RICHARD FERNANDEZ
> $query->param(-name=>'foo', -value=>'the value'); Make that line $query->param(-name=>'foo', -value=>"$the_value"); Then somwhere at the start where you get the variables; my $name = $query->param('name')||''; if ($name =~/mary/i){ $the_value = "Howdy Mary" } How you do it depends on you

Re: selecting a part of a string

2006-09-23 Thread Rob Dixon
Adriano Allora wrote: > > hi to all, > > another silly question about a pattern matching which should work but it > doesn't. > > I have a list af string similar to this one: > > parola|n.c.,0,fem,sg,0|parola > > and I need to select all the chars before the pipe and put them in a > variable. >

Re: selecting a part of a string

2006-09-23 Thread D. Bolliger
Adriano Allora am Sunday, 24. September 2006 01:12: > hi to all, > > another silly question about a pattern matching which should work but > it doesn't. > > I have a list af string similar to this one: > > parola|n.c.,0,fem,sg,0|parola > > and I need to select all the chars before the pipe an

Re: selecting a part of a string

2006-09-23 Thread John W. Krahn
Adriano Allora wrote: > hi to all, Hello, > another silly question about a pattern matching which should work but it > doesn't. > > I have a list af string similar to this one: > > parola|n.c.,0,fem,sg,0|parola > > and I need to select all the chars before the pipe and put them in a > vari

Re: CGI: How do I populate a form field based on the value entered in a different field

2006-09-23 Thread Owen
On Sat, 23 Sep 2006 14:21:50 -0400 "RICHARD FERNANDEZ" <[EMAIL PROTECTED]> wrote: > I'm trying to create an HTML form that will refresh itself based on user > input. In the POD for CGI it says that you can set the value of a named > parameter by using something like: > > $query->param(-name=>'f

selecting a part of a string

2006-09-23 Thread Adriano Allora
hi to all, another silly question about a pattern matching which should work but it doesn't. I have a list af string similar to this one: parola|n.c.,0,fem,sg,0|parola and I need to select all the chars before the pipe and put them in a variable. That substitution does'n work:

RE: How do I populate a form field based on the value entered in a different field

2006-09-23 Thread Charles K. Clarkson
RICHARD FERNANDEZ wrote: : For example, if the user types "Wilma" into the textbox, : the script should populate the target textbox with my : edited value, say, "Betty". That sounds like a client side script, like JavaScript or ECMAscript, not perl. With server side perl, you'll need to submi

Re: writing a package

2006-09-23 Thread Tom Phoenix
On 9/23/06, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote: t/1Test header seen more than once! use Test::More tests => 1; BEGIN { $| = 1; print "1..3\n";} Using Test::More outputs the test header line, so you don't need to print "1..3\n"; but be sure to use the correct number of tes

CGI: How do I populate a form field based on the value entered in a different field

2006-09-23 Thread RICHARD FERNANDEZ
Hi folks, I'm trying to create an HTML form that will refresh itself based on user input. In the POD for CGI it says that you can set the value of a named parameter by using something like: $query->param(-name=>'foo', -value=>'the value'); But it doesn't say (or at least I didn't see) anythin

writing a package

2006-09-23 Thread Johnson, Reginald \(GTI\)
As a learning exercise I am trying to write a perl module that compare files. This is an example from Effective Perl Programming Book by Joseph Hall. My error occurs when I run make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arc

RE: Question on the "Camel" book

2006-09-23 Thread John
Upon reflection -- and I'm surprised Randal hasn't picked this up -- the "problem" might be more deep-seated than we imagine. With respect to the good Perl-Meisters who've answered so far, I should like to add this: Shouldn't it be "Flotsam", and not "flotsan"? (Hey! After all, somebody'

Re: problem with stat?

2006-09-23 Thread Dr.Ruud
"Dr.Ruud" schreef: > Thomas Bätzler: >> [ !/^\.$|^\.\.$/ and !/^\.\.?$/ ] >> I'm assuming that this regex would be faster, too, since it >> does not contain an alternation. > > That is hard to say without actual benchmarking: the regex-optimizer > gets better with every new version of perl. See

Re: problem with stat?

2006-09-23 Thread Dr.Ruud
Mathew schreef: > Dr.Ruud wrote: >> Thomas Bätzler schreef: >> >>> [ !/^\.$|^\.\.$/ and !/^\.\.?$/ ] >>> I'm assuming that this regex would be faster, too, since it >>> does not contain an alternation. >> >> That is hard to say without actual benchmarking: the regex-optimizer >> gets better with

Re: problem with stat?

2006-09-23 Thread Dr.Ruud
Mathew schreef: > I had tried this > > /^[.]$|^[..]$/ but had been getting errors about Posix. I'm not at > the same system or even same OS now so I can't reproduce though. [..] is equal to [.], like [cbbbaaa] is equal to [a-c]. See `perldoc perlre`. -- Affijn, Ruud "Gewoon is ee

Your opinion on large file processing

2006-09-23 Thread Andrej Kastrin
Dear all, the script below count word occurences in input file. It uses simple hash structure to store unique words and its frequencies. use strict; my %words; while (<>) { chop; foreach my $wd (split) { $words{$wd}++; } } foreach my $w (