Match and remove an element in an array

2002-03-15 Thread Rob Roudebush
Okay my script takes names from a fom and puts them into an array - then later I need to match a $variable (one of the names) against that array and take that specific element out of the array. I figure there is probably an easy function to do this? array=(john, lucy, mike); $name=john I

Help for Class-Tree module

2002-03-15 Thread shilpa deshpande
Hi All, I want to use the Class-Tree-1.20 module. But I am unable to install and use it b'coz it is giving some error Environment variable 'perceps' not found I have read the README file and documentation for 'perceps'. But still I am unable to resolve it. Can you please help me? Thanks,

Re: Match and remove an element in an array

2002-03-15 Thread fliptop
Rob Roudebush wrote: Okay my script takes names from a fom and puts them into an array - then later I need to match a $variable (one of the names) against that array and take that specific element out of the array. I figure there is probably an easy function to do this? @array=(john, lucy,

Re: Match and remove an element in an array

2002-03-15 Thread Andre` Niel Cameron
Here is my way: if(scalar(grep(/^$object$/, @Equipped))) { @Equipped= grep { $_ ne $object } @Equipped;} It searches the array @Equipped for an objext if it finds it then removes it be searching threw the whole array and skiping the object as it assigns it to the array. Hope this helps.

Re: How can I Track the client IP, when a web request is made to my server.

2002-03-15 Thread Vijay Kumar
hi, Thank You. This problem is solved when a client is contacted Directly to my server. But What about Other users connecting through their Proxy's Is there any chance to Rectify this Thanx vijay - Original Message - From: Rob Roudebush To: vijayak ; [EMAIL PROTECTED]

customising forms

2002-03-15 Thread Matthew Harrison
what do i have to do to make changes to a form like change the background colour of a text field or the face of a button? is it in perl or what? -- Matthew Harrison Internet/Network Services Administrator Peanut-Butter Cheesecake Hosting Services Genstate www.peanutbuttercheesecake.co.uk --

RE: customising forms

2002-03-15 Thread Hanson, Robert
That all depends on if you want to do it server side or client side. I usually prefer the server side, in which case your Perl script would handle that. The easiest way is to use some sort of template module, I usually use HTML::Template.

parsing a domain name out of an email address

2002-03-15 Thread Eric Peers
I'm attempting to parse a domain name out of a email address with the following code: my $EmailAddress = $to; if ($EmailAddress =~ (/^\w+\@aol\.com)$/i){ my $msg = /www/docs/sips_mar02aol.txt; } else my $msg = /www/docs/sips_mar02.html; } Being new to regular

RE: parsing a domain name out of an email address

2002-03-15 Thread Tim Doty
for starters the regex is invalid. the first closing parens comes too soon. try: if ($EmailAddress =~ (/^\w+\@aol\.com$/i)){ tim -Original Message- From: Eric Peers [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 1:45 PM To: [EMAIL PROTECTED] Subject: parsing a domain

Re: parsing a domain name out of an email address

2002-03-15 Thread Eric Peers
Thank you. That helped get the script to compile. Neither file is being opened, but that me be a permissions issue. I've expanded the code out a bit (and made a correction to the if/then statement): my $EmailAddress = $to; if ($EmailAddress =~ (/^\w+\@aol\.com$/i)) { my $msg =

RE: parsing a domain name out of an email address

2002-03-15 Thread Rand Cufley
Hi Eric, I believe you need a blank line after the email header before you start your message body. -Rand -Original Message- From: Eric Peers [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 11:50 AM To: Tim Doty; [EMAIL PROTECTED] Subject: Re: parsing a domain name out of an

RE: html in a cgi script

2002-03-15 Thread Jessica Ortiz
Hi Scott, I am in the same boat like Matthew here. Do you have any examples to implement selection list boxes, text boxes, as well as checkboxes? I'd just like to see how you would do that using this style of html: use CGI; # use CGI.pm $q = new CGI; # initiate a new CGI object

RE: html in a cgi script

2002-03-15 Thread Scot Robnett
Jessica, most of the information you are looking for is available in the help documentation for CGI.pm. Try 'perldoc CGI.pm' and go through it until you find the form examples. Here's a *very* basic example of a form with a select menu: #!/usr/bin/perl use CGI; use strict; my $q = new CGI;

RE: html in a cgi script

2002-03-15 Thread Scot Robnett
Sorry, setting up the CGI object was useless in that case, since I didn't use the object to create the fields. My bad. Sorry. -Original Message- From: Scot Robnett [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 6:13 PM To: Jessica Ortiz; [EMAIL PROTECTED] Subject: RE: html in

Secure Logoff from Session CGI

2002-03-15 Thread Sean Abrahams
I have a small series of web pages that talks to a database and uses forms to input/alter data. In order to get to these web pages a user has to authenticate. If valid, I put a cookie on their machine that expires in 10 minutes. So basically, they can use the forms for up to 10 minutes, from

Re: Secure Logoff from Session CGI

2002-03-15 Thread Rob Roudebush
I'm not sure, but how do you set a cookie and have it expire in ten minutes? -Rob --- Sean Abrahams [EMAIL PROTECTED] wrote: I have a small series of web pages that talks to a database and uses forms to input/alter data. In order to get to these web pages a user has to authenticate. If

RE: Save image to disk

2002-03-15 Thread Gary Hawkins
Had to uninstall ActivePerl and reinstall, rather than just install over older version, and then it worked, no need to 'ppm install LWP::Simple'. use LWP::Simple; if (my $img = get($image_url)) { open OUT, $file_to_write; binmode OUT;

interesting question about variables

2002-03-15 Thread Martin A. Hansen
hi i have a loop containing the following block of code. however, first time the loop is run, $text_link is empty, which it shouldn't be. i cant move the declaration of $text_link above the if statment, because then the $figure_name would be empty. now i guess im really missing out on

Re: interesting question about variables

2002-03-15 Thread Jonathan E. Paton
if ( ( $hash - { $paragraph } ) =~ s/###(\w+.*\.jpg)###/($text_link)/ ) { Obviously you ain't using warnings or strict if $text_link has any chance of being undefined. Also, you should have a else clause, looking something like: else { undef $test_link; } Jonathan Paton

perl system function

2002-03-15 Thread Kubert
I am writing a perl program in which I need to execute a korn shell script and pass it multiple arguments. I am assuming that I can use the system routine but I am not sure what the syntax would be. Can you help? -- __ Your

Re: perl system function

2002-03-15 Thread Jonathan E. Paton
--- Kubert [EMAIL PROTECTED] wrote: I am writing a perl program in which I need to execute a korn shell script and pass it multiple arguments. I am assuming that I can use the system routine but I am not sure what the syntax would be. Can you help? Do you need information back? If

Re: interesting question about variables

2002-03-15 Thread Jenda Krynicky
From: [EMAIL PROTECTED] (Martin A. Hansen) i have a loop containing the following block of code. however, first time the loop is run, $text_link is empty, which it shouldn't be. i cant move the declaration of $text_link above the if statment, because then the $figure_name

Perl Tk.

2002-03-15 Thread David Samuelsson (PAC)
I am planning to write a litte graphical interface for an application that has a full CLI. Perl Tk, should accomplish this. What i need is more information then the one that is in the perlfaq, i need instructions, faqs,snippets, all i can get, can anyone point me in the right direction for

Trouble with Math::NumberCruncher

2002-03-15 Thread Tirthankar C. Patnaik
This might seem trivial, but it has me stumped. The variance of numbers 0..20 is 38.5. Then why does Math:NumberCruncher show it as 36.6667? Here's a sample prog, and it's output. Here test04.dat is a file that has numbers 0 to 20, on separate lines. #---start

Re: Trouble with Math::NumberCruncher

2002-03-15 Thread Nick_D_Montpetit
Hi Tirthankar, I knew my Graduate work in Statistics would come in handy at some point... :-) Without looking at the documentation for Math:NumberCruncher, I can fairly confidently say that both you and Math:NumberCruncher are right, but you are trying to calculate different things. In the

Re: Trouble with Math::NumberCruncher (fwd)

2002-03-15 Thread Tirthankar C. Patnaik
Hi Nick, I cannot tell you how ashamed I am. This should've been absolutely obvious to me (I also did graduate studies in Statistics, after which I switched to Economics, and Finance.) I guess it's TGIF feeling, or just workload, but my mind didn't perhaps work, when I failed to

Re: perl system function

2002-03-15 Thread William.Ampeh
Remember your command ticks. $my_output = `do_something`; __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Parsing CGI data to another page...

2002-03-15 Thread David Gray
Just wondering how I would go about having this URL www.mydomain.com/cgi-bin/test.cgi?data=test Would be parsed to... www.mydomain.com/cgi-bin/test2.cgi From test2.cgi I would like to be able to read that data = test from test.cgi. In test.cgi, do the following =code use CGI; my

RE: interesting question about variables

2002-03-15 Thread David Gray
if ( ( $hash - { $paragraph } ) =~ s/###(\w+.*\.jpg)###/($text_link)/ ) { $figure_name = $1; $text_link = $cgi - a({-href = javascript: window.open('$pix_dir/$figure_name', . '', . 'status=yes,

RE: Re-displaying data back into forms

2002-03-15 Thread David Gray
Hi Troy, Then I have the following code to re-assign it to variables: --- unless ($action) { open (TEMP,$filename2) or die Can't Open $filename2: $!\n; $line = TEMP; close(TEMP); ($dt, $time, $topic, $eurom) = split(/\|/, $line); $eurom

Re: Trouble with Math::NumberCruncher

2002-03-15 Thread John W. Krahn
Tirthankar C. Patnaik wrote: This might seem trivial, but it has me stumped. The variance of numbers 0..20 is 38.5. Then why does Math:NumberCruncher show it as 36.6667? Here's a sample prog, and it's output. Here test04.dat is a file that has numbers 0 to 20, on separate lines.

Can I use html templates with perl ???

2002-03-15 Thread A Taylor
Hi all, I wonder if anyone can help me - i am writting some perl scripts that read information off a database. What I want to do is use different html templates (the location if which can be stored on the database) to display the relevant information. For example: if i read data off a database

RE: Can I use html templates with perl ???

2002-03-15 Thread David Gray
What I want to do is use different html templates (the location if which can be stored on the database) to display the relevant information. For example: if i read data off a database that has 3 pictures i would use 1 template, if the page has 4 pics i would use another template.

printf and archive questions

2002-03-15 Thread Brian Warn
Hi, two questions: is there an easy way -- using printf, etc. -- to format 100 such that it appears as 1,000,000? Also, is there a searchable archive of the beginner list anywhere? Thanks, Brian -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: printf and archive questions

2002-03-15 Thread Jeff 'japhy' Pinyan
On Mar 15, Brian Warn said: Hi, two questions: is there an easy way -- using printf, etc. -- to format 100 such that it appears as 1,000,000? Also, is there a searchable archive of the beginner list anywhere? As per commas, the Perl FAQ has the answer: perldoc -q commas As for the

RE: printf and archive questions

2002-03-15 Thread Hanson, Robert
I don't know of a searchable archive. To format the number you can either roll your own, grab the solution in the Perl Cookbook, or use Number::Format. http://search.cpan.org/search?mode=modulequery=Number%3A%3AFormat use Number::Format; my $commaNum = new Number::Format(-thousands_sep =

Simple LWP web retrieval question

2002-03-15 Thread siren jones
I tried the following code to retrieve netCDF data files from a website. use LWP::Simple getstore(source_url/, input_filename); The problem is when I go to read the netCDF file I can't. It is as if it does an ASCII transfer instead of a binary or some such thing? Don't really know. Any

Re: Perl Tk.

2002-03-15 Thread Peter_Farrar
I've been growing interested in the Tk module too. I found this today. It's really really introductory. http://www.perl.com/pub/a/1999/10/perltk/

problem redirecting STDOUT to file in TCP socket server script

2002-03-15 Thread news reader
Hello, I have a perl script which is working as TCP socket server. In this I am redirecting STDOUT to file. with command in the begining of the script: open STDOUT, './tRL.out' or die ./tRL.out: $!; I have following four print STDOUT commands while (accept(CLIENT,SERVER)) {

Re: Simple LWP web retrieval question

2002-03-15 Thread Elaine -HFB- Ashton
siren jones [[EMAIL PROTECTED]] quoth: *I tried the following code to retrieve netCDF data files from a website. * *use LWP::Simple * getstore(source_url/, input_filename); perl -MLWP::Simple -e 'getstore http://www.cpan.org,foo;' works like a charm. However, yours, with the addition of -w

system command problem

2002-03-15 Thread Gavin Nelmes-Crocker [CobaltWorld]
Guys, I've got a newbie question - I have been hacking at a perl script to change it to do what I want - it nearly does but I can't understand why the main bit isn't working. Basically the script gets sent a string from an html form which it then needs to use as part of a system command. I'm

kung foo

2002-03-15 Thread crash
when studying PERL, how many months does it generally take to get past the baby talk stage? any estimates? __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

RE: kung foo

2002-03-15 Thread Naika - EV1
Months you say? hehehe I don' think I'll ever get out of it. - naika http://www.naikaonline.com -Original Message- From: crash [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 3:49 PM To: [EMAIL PROTECTED] Subject: kung foo when studying PERL, how many months does it

Re: system command problem

2002-03-15 Thread Curtis Poe
--- Gavin Nelmes-Crocker [CobaltWorld] [EMAIL PROTECTED] wrote: Guys, I've got a newbie question - I have been hacking at a perl script to change it to do what I want - it nearly does but I can't understand why the main bit isn't working. Basically the script gets sent a string from an html

RE: kung foo

2002-03-15 Thread Timothy Johnson
It took me about six months before I started to feel like I could hold my own. Of course, four months later I realize that I just didn't know enough about some things to realize how much more I needed to know. For me one of the great things about Perl is that you can learn the basics very

Re: kung foo

2002-03-15 Thread Jonathan E. Paton
when studying PERL, how many months does it generally take to get past the baby talk stage? Assuming full time, and some experiance of other languages you should be quite proficent after 2-3 months... I created my first script, Tk script, module and object by then - albeit they were'nt

param function

2002-03-15 Thread Mariusz
hi, I have a html form with over 100 fields, is there a quick way to assign them in the way that the scalar name becomes the name of the field and the value of the field is being assigned to that scalar? I know I can just type it one by one: $name = param('name'); $lastname = param('lastname');

Re: param function

2002-03-15 Thread Tanton Gibbs
You can use the import_names function of CGI import_names( 'R' ); print name = , $R::name; This function will import all of the parameters into the namespace provided as the argument (in this case, R). If the parameter is multivalued, then you can use the array form( e.g. @R::name ).

RE: param function

2002-03-15 Thread Tiller, Jason
Hi, Mariusz, :) I don't qualify as an expert, but this might do the trick: my %params; $params{$_} = param($_) foreach param(); If I understand your code correctly, param() returns a list of all the possible keys, right? If so, then the above code should work. You refer to the parameters as

eval and BEGIN

2002-03-15 Thread James Kelty
I have looked through the Camel book a couple of times, and I am still confused as to the usefullness of the eval, and BEGIN type structures. Could someone give me a 'real-world' example, and possibly another explanation of the two structures? I would like to know if I should be using them in my

Re: eval and BEGIN

2002-03-15 Thread Jenda Krynicky
From: James Kelty [EMAIL PROTECTED] I have looked through the Camel book a couple of times, and I am still confused as to the usefullness of the eval, and BEGIN type structures. Could someone give me a 'real-world' example, and possibly another explanation of the two

the scope of 'use strict'

2002-03-15 Thread Yuan Cheng
HI, all: I am wondering what else 'use strict' does besides it is stated in the perldoc that it stricts on use of 'vars', 'refs' and 'subs'. Thanks. yc __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ --

Problems running Win32's net use with system()

2002-03-15 Thread Francoys Crepeau
Hi everyone! I hope someone can tell me what I'm doing wrong. I'm running ActivePerl 5.6 on an NT4 (service pack 5) box. One of the things I have to do is to have a Perl script map a network drive to a drive letter. When one manually does this from the command line, it is done using the net

RE: the scope of 'use strict'

2002-03-15 Thread Timothy Johnson
The 'use strict' pragma is a little hard to get used to if you have been coding a while without it, but can be a great help in creating and debugging your programs. 'use strict' lets the perl interpreter know that you want all variables, subs, and references to be declared and scoped.

RE: Problems running Win32's net use with system()

2002-03-15 Thread Timothy Johnson
Maybe system() isn't the right way to go with this. Try using backticks (`net use * server\\share`) or use the Win32::Lanman modules NetShareAdd() function. My personal take on system() and backticks is that they should only be used when absolutely necessary. You can control what Perl

Re: Problems running Win32's net use with system()

2002-03-15 Thread John W. Krahn
Francoys Crepeau wrote: Hi everyone! I hope someone can tell me what I'm doing wrong. Hello, I hope so too. I'm running ActivePerl 5.6 on an NT4 (service pack 5) box. One of the things I have to do is to have a Perl script map a network drive to a drive letter. When one manually does

Open for business caculation

2002-03-15 Thread Eric Beaudoin
Hi everyone, I'm working on a script that will compile statistics for helpdesk tickets. To compute these stats, I need to be able count the number of business hours between the opening and the resolution of tickets. The working hours are 08:00 to 17:00 so a ticket opened on Monday at 16:00

RE: Problems running Win32's net use with system()

2002-03-15 Thread Francoys Crepeau
You're right! It appears that I'd been considering net use to be a command, when it appears that net is the command and use is a modifer. I haven't been able to double check it yet here at home, but when I modify the test program to invoke only net use, I get the expected report, and the test