[11912] in Perl-Users-Digest
Perl-Users Digest, Issue: 5512 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 28 21:07:16 1999
Date: Wed, 28 Apr 99 18:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 28 Apr 1999 Volume: 8 Number: 5512
Today's topics:
Re: Apache mod_perl script won't exit on Apache::exit() <t-armbruster@ti.com>
Re: associative array problem (Larry Rosler)
Better way? download a file from perl <flighttime@earthlink.net>
Re: emergent problem - binary file in perl <swarren@slip.net>
Re: Help! - Trouble with CGI script written in Perl. <aperrin@mcmahon.qal.berkeley.edu>
Re: Help! - Trouble with CGI script written in Perl. <t-armbruster@ti.com>
Re: Help! - Trouble with CGI script written in Perl. <emschwar@rmi.net>
Re: Help! - Trouble with CGI script written in Perl. <cassell@mail.cor.epa.gov>
Re: How do i print something using perl? <swarren@slip.net>
Re: How do you find perldoc? <cassell@mail.cor.epa.gov>
Re: How do you find perldoc? <tim@timbury.com>
Re: Impythonating PERL? (Avery Andrews)
Informix DBD disconnect & C++ code <brian@marketorder.com>
Re: Learning Perl <cassell@mail.cor.epa.gov>
May 3rd, SV.pm First Meeting!! fxia@yahoo.com
May 3rd, SV.pm First Meeting!! fxia@yahoo.com
Module/package to do box plots? (Chris Cannon)
Re: mSQL and Perl? <flighttime@earthlink.net>
Net::FTP Invalid Port Command (Gus)
Re: Net::FTP Invalid Port Command <richb@ezl.com>
Re: NewBie: using If statment with multiple expressions (Tad McClellan)
Re: part of a variable <swarren@slip.net>
Re: part of a variable (Larry Rosler)
Re: Simple if syntax Question <swarren@slip.net>
Re: Simple one? <jdf@pobox.com>
Re: Simple one? <cassell@mail.cor.epa.gov>
Re: strange problem with the month from a date!! <cassell@mail.cor.epa.gov>
Re: stupid single quote " wipes out REST OF TEXT NOSPAMcrstlblu@planet.eon.net
test please ignore <hattons@cpkwebser5.ncr.disa.mil>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Apr 1999 18:20:12 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: Apache mod_perl script won't exit on Apache::exit();
Message-Id: <sMMV2.27$GU3.2154@dfw-service1.ext.raytheon.com>
Sounds like a problem for a newsgroup with cgi in its name
------------------------------
Date: Wed, 28 Apr 1999 15:59:09 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: associative array problem
Message-Id: <MPG.1191329a231d0f3398996d@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7g81of$d8$1@nnrp1.dejanews.com> on Wed, 28 Apr 1999 22:23:15
GMT, bing-du@tamu.edu <bing-du@tamu.edu> says...
> Look at the following code snippet. I want the subroutin 'change' to return
> an associative array (%test2) and assign it to another associative array
> (%test1) in the main program. Unfortunately this code did not give me what I
> want. The output is: new test1 is: test2:
>
> I have no trouble with general arrays (@). Reference problem? Can anybody
> shed some light on this? Thanks in advance.
...
> #!/usr/local/bin/perl
Problem 1: No ' -w' at the end of this, which would have helped a lot
in understanding the problem.
Problem 2: No 'use strict;'
> my %test1 = (one,1,two,2);
Problem 3: Barewords. Change the first and third commas to => .
> %test1 = &change;
>
> print "new test1 is:\n";
>
> foreach $key (keys %test1)
> {
> print "$key: $test1{$key}\n";
> }
>
> exit;
>
> sub change {
> my %test2 = (three,3);
Problem 4: Bareword. Change the comma to => .
> return(test2);
Problem 5: Bareword. Change to %test2 .
> }
#!/usr/local/bin/perl -w
use strict;
my %test1 = (one => 1, two => 2);
%test1 = &change;
print "new test1 is:\n";
foreach my $key (keys %test1)
{
print "$key: $test1{$key}\n";
}
sub change {
# my %test2 = (three => 3);
# %test2
three => 3 # This works just as well!
}
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 28 Apr 1999 00:44:13 -0700
From: Greg Lucas <flighttime@earthlink.net>
Subject: Better way? download a file from perl
Message-Id: <280419990044133791%flighttime@earthlink.net>
Greetings all,
I'm trying to allow users to download a file created on the fly from
a script using:
print "Content-type: application/plain\n\n";
and then a while statement that reads through the file.
Is there a way to name this file? right now it comes across as the name
of the script. Is there a better way to accomplish this. System calls?
It would be nice to also be sure that the file doesn't end up in the
user's browser.
Greg
------------------------------
Date: Wed, 28 Apr 1999 23:56:03 GMT
From: "Stephen Warren" <swarren@slip.net>
Subject: Re: emergent problem - binary file in perl
Message-Id: <neNV2.4312$gv5.2308@news.rdc1.sfba.home.com>
Bradley W. Langhorst <bwlang@nospam.genome.wi.mit.edu> wrote in message
news:37274E8C.1FD6B084@nospam.genome.wi.mit.edu...
> im reading a bunch of binary files into memory
> using the following construct
>
> $filesize = -s FAMFILE;
> for ($i=0;$i<$filesize;$i++) {
> sysread FAMFILE, $tmp1[$i], 1
> print hex($tmp[$i]);
> }
You may want to make the variable you read the data into have the same name
as the variable you print out.....
------------------------------
Date: Wed, 28 Apr 1999 15:52:07 -0700
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: Help! - Trouble with CGI script written in Perl.
Message-Id: <37279117.27A15EB2@mcmahon.qal.berkeley.edu>
Environment? Version? Specific problem?
Pizdobol wrote:
> Hello there,
>
> I have tried my best for many hours to make this script work, but It still
> doesn't run. ;(
>
> Can anybody take a fresh look at it and help me to determine what is
> actually wrong with it?
> Thank you in advance.
...snip...
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: Wed, 28 Apr 1999 18:05:34 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: Help! - Trouble with CGI script written in Perl.
Message-Id: <KyMV2.26$GU3.2152@dfw-service1.ext.raytheon.com>
Try explaining what your script does, what specific problems you are having,
and keeping the code posted to 40 lines or less.
Pizdobol wrote in message <37278de3.0@lightning.ica.net>...
>Hello there,
>
> I have tried my best for many hours to make this script work, but It still
>doesn't run. ;(
>
------------------------------
Date: 28 Apr 1999 17:40:13 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Help! - Trouble with CGI script written in Perl.
Message-Id: <xkf676gl3fm.fsf@valdemar.col.hp.com>
"Pizdobol" <pizdobol@hotmail.com> writes:
> I have tried my best for many hours to make this script work, but It still
> doesn't run. ;(
Why not?
> Can anybody take a fresh look at it and help me to determine what is
> actually wrong with it?
Not unless you can trim down the script from the 1300+ lines to something
reasonable to post to USENET. But I'm feeling generous, so I'll give you
three answers that, if followed, will fix a good 80-90% of your bugs.
> #!/usr/local/bin/perl
Hint 1: #!/usr/local/bin/perl -w
Hint 2: use strict;
Hint 3: Stop inventing the wheel. Instead of using your own probably
broken HTTP parsing routines, use CPAN. If you don't know what
CPAN is, read the FAQ. If you can't find the FAQ, your perl
installation's broken.
-=Eric
------------------------------
Date: Wed, 28 Apr 1999 17:27:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Help! - Trouble with CGI script written in Perl.
Message-Id: <3727A764.8F60B341@mail.cor.epa.gov>
Pizdobol wrote:
>
> Hello there,
>
> I have tried my best for many hours to make this script work, but It still
> doesn't run. ;(
>
> Can anybody take a fresh look at it and help me to determine what is
> actually wrong with it?
> Thank you in advance.
>
> <-start->
> #!/usr/local/bin/perl
It is really pretty rude to dump this amount of trafe on us and expect
someone to solve all your problems for free. And I doubt you can
afford the consulting fees.
But I'll give you a tip. Change that first line to:
#!/usr/local/bin/perl -w
I'd suggest you put
use strict;
as your second line, but it'll choke on too much of this code.
What works? What doesn't work? What OS is it on? Server? What
version of Perl? Are there error messages? What's in the error
log? Why isn't this using CGI.pm? Does this work from the command
line? Does a test script work on your server?
If you can cut your code down to less than 40 lines which reproduce
the exact problem you're seeing, maybe we can help you.
But first, read the helpful e-mail you'll get from gnat. And
follow every bit of advice in it, very carefully.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Wed, 28 Apr 1999 23:28:01 GMT
From: "Stephen Warren" <swarren@slip.net>
Subject: Re: How do i print something using perl?
Message-Id: <5QMV2.4304$gv5.2330@news.rdc1.sfba.home.com>
[Seriously off-topic]
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.net> wrote in
message news:3726D0B9.EF843CF@gmx.net...
>
> It might, for example, be a "pure PostScript" printer. Or some weird
> WinPrinter with absolutely no DOS support[1]. But we can't tell from
> here.
>
> [1] reminds me of the Joyce (aka PCW8512) that Amstrad/Schneider used to
Aha! So *that's* what the J is for...
I always wondered why the CP/M system files were named:
C10CPM3.SYS (CPC, v1.0, CP/M v3)
J14CPM3.SYS (Joyce, v1.4, CP/M v3)
The first letter is the machine name - now I know what the J actually means!
------------------------------
Date: Wed, 28 Apr 1999 16:18:56 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How do you find perldoc?
Message-Id: <37279760.5308EF93@mail.cor.epa.gov>
steve wrote:
>
> Hi
>
> I'm trying to look for the perldoc, but I don't
> know how to do it. should I go into ppm to look for it
> or somewhere else?
If you have ppm, then I'll assume you're on a win32 box using
ActiveState Perl. Unless you gave the InstallWizard some bad
suggestions, you have perldoc installed on your machine.
You can access it just by opening up a command prompt window
and typing:
perldoc perldoc
to get a help screen for the program. Be sure to read about the
-q and -f options, which are very useful. So the next time you
have a question, you can check whewther it's in the FAQ first
and save yourself a lot of time.
If you prefer, you can read the docs and FAQ in your favorite
web browser, locally. The install gave you the choice of where
to stick the online doc info into your Start menu. So go there,
click on it, and read away. Note that the frames are implemented
in PerlScript, not JavaScript or VBScript.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Wed, 28 Apr 1999 19:18:56 -0400
From: "Tim" <tim@timbury.com>
Subject: Re: How do you find perldoc?
Message-Id: <925341519.361.88@news.remarQ.com>
>From the system command line type:
perldoc -?
steve wrote in message <372773cd@discussions>...
>
>Hi
>
>I'm trying to look for the perldoc, but I don't
>know how to do it. should I go into ppm to look for it
>or somewhere else?
>
>Thanks
>
>--Posted from EarthWeb Discussions. http://discussions.earthweb.com
>
------------------------------
Date: 28 Apr 1999 17:15:04 -0700
From: andrews@Turing.Stanford.EDU (Avery Andrews)
Subject: Re: Impythonating PERL?
Message-Id: <7g88a8$p36@Turing.Stanford.EDU>
In <slrn7ie5op.n42.gabor@vnode.vmunix.com> gabor@vmunix.com (Gabor) writes:
>In comp.lang.perl.misc, Avery Andrews <andrews@Turing.Stanford.EDU> wrote :
># It seems to me that it would be cool to be able to use python-style
># whitespace-formatting when you wanted it, writing something like:
>If you want to program in Python, why don't you program in Python?
>This kind of idiocy is just that, idiocy.
Actually, I do both (tho at a rather low leve of proficiency), & while
I like PERL better for getting little things done quick, I waste
a lot of time looking for errors because of the punctuation, which
often causes the detected error to appear considerably after the
real mistake. So I'd like to have my cake and eat it too.
Anyway, since you have to lay code out that way to make it readable
later, what's so dumb about using the whitespace to lose the
punctuation?
- Avery.Andrews@anu.edu.au
------------------------------
Date: Wed, 28 Apr 1999 16:42:53 -0700
From: "Brian Carlson" <brian@marketorder.com>
Subject: Informix DBD disconnect & C++ code
Message-Id: <7g86bi$9bp$1@sparky.wolfe.net>
I am having a problem with the $dbh->disconnect call.
>From a C++ program which already has a database connection, I call a Perl
program that accesses an Informix online 7.23 database and formats some
data. However, when I return to the C++ my original database connection is
disconnected. Any ideas why?
Here's the run-down.
C++ code
established datbase connection
does some work
calls Perl formatting exit
Perl
does $dbh->connect(.........
reads the database info & formats data
does $dbh->disconnect;
Return to C++
Original database connection is gone.
The connections have different names and shouldn't be related. Why is the
$dbh>disconnect disconnecting both???
Brian
------------------------------
Date: Wed, 28 Apr 1999 17:13:49 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Learning Perl
Message-Id: <3727A43D.9C7AFA8@mail.cor.epa.gov>
<waves arms> Hey Randal, does the subject line sound familiar?
ITTE wrote:
>
> ***Accelerated Perl Programming Training, (Intro-Interm.)
> [SNIP]
> own. To our knowledge, no other training provides this much learning in
> such a brief time.
Presumptive, aren't they? Or is that the wrong adjective... :-)
> ***Advanced Perl Programming Training
> ['NOTHER SNIP]
> capabilities that can be used to write procedures in Perl. Attendees will
> learn to master the techniques of Perl in just two days.
Shouldn't that be "some attendees will learn..."
I don't think I've ever seen an ad from them in TPJ. Do we know any of
their trainers?
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Thu, 29 Apr 1999 00:12:00 GMT
From: fxia@yahoo.com
Subject: May 3rd, SV.pm First Meeting!!
Message-Id: <7g884f$629$1@nnrp1.dejanews.com>
Silicon Valley Perl Mongers
At last! A Perl Mongers group in the heart of Silicon Valley!
Charter Meet monthly to lecture/discuss/heckle Perl issues, like
mod_perl, CGI, DBI, LDAP, I18N, security, etc. under
auspices of the Perl Mongers
Organizers James and Fred
Netscape Bldg 22, Sputnik Room (Cafeteria Bldg), 468
Location Ellis St. near East Middlefield, Mountain View, CA
Directions to Netscape
Next Meeting Monday, May 3, 1999 7:00 pm
Randal Schwartz, Topic "Advanced Web Programming with
Perl"
Speaker Although Randal needs no introduction, here's one
anyway: he is the author of Learning Perl, co-author of
Programming Perl, and one of the leading Perl trainers.
He also writes a column for Web Review Magazine
Sponsors Thanks to Netscape for the meeting room and RF.net for
web hosting
See You There!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 29 Apr 1999 00:14:04 GMT
From: fxia@yahoo.com
Subject: May 3rd, SV.pm First Meeting!!
Message-Id: <7g888a$62t$1@nnrp1.dejanews.com>
Silicon Valley Perl Mongers
[http://www.rf.net/~sv-pm-org]
At last! A Perl Mongers group in the heart of Silicon Valley!
Charter Meet monthly to lecture/discuss/heckle Perl issues, like
mod_perl, CGI, DBI, LDAP, I18N, security, etc. under
auspices of the Perl Mongers
Organizers James and Fred
Netscape Bldg 22, Sputnik Room (Cafeteria Bldg), 468
Location Ellis St. near East Middlefield, Mountain View, CA
Directions to Netscape
Next Meeting Monday, May 3, 1999 7:00 pm
Randal Schwartz, Topic "Advanced Web Programming with
Perl"
Speaker Although Randal needs no introduction, here's one
anyway: he is the author of Learning Perl, co-author of
Programming Perl, and one of the leading Perl trainers.
He also writes a column for Web Review Magazine
Sponsors Thanks to Netscape for the meeting room and RF.net for
web hosting
See You There!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 28 Apr 1999 22:58:30 GMT
From: cannon@netcom.com (Chris Cannon)
Subject: Module/package to do box plots?
Message-Id: <cannonFAx95I.9F8@netcom.com>
I use the Graph module for line graphs, but I also
need to to box plots (shows distribution info on a set of data)
If anyone knows of a package or module that can do this, thanks.
--
--
=================
cannon@netcom.com
------------------------------
Date: Wed, 28 Apr 1999 14:29:01 -0700
From: Greg Lucas <flighttime@earthlink.net>
Subject: Re: mSQL and Perl?
Message-Id: <280419991429014543%flighttime@earthlink.net>
This should get you started.
Greg
use Msql;
$dbh = Msql->Connect("your server", "your dataase");
$sth=$dbh->Query(
qq|SELECT
your data
FROM your table |) || die "could not perform Select";
@row = $sth->FetchRow();
undef ($sth);
In article <37277E4B.4ACB2B41@reuna.cl>, Sodesoft Ltda.
<sodesoft@reuna.cl> wrote:
> Hi
>
> I want to access mSQL data from perl script.
> How can I do that?
>
> Thax a lot!
>
> Jose Gallegos A.
------------------------------
Date: Tue, 27 Apr 1999 23:42:44 GMT
From: spg@quokka.com (Gus)
Subject: Net::FTP Invalid Port Command
Message-Id: <3726489c.203149423@news.earthlink.net>
Hi,
In trying to use Net::FTP with the code below, I get a response back
from the FTP server saying either "Invalid Port Command" or "Port
argument must be 1025 or greater" ( it seems to depend on which
netscape ftp server picks up the request).
The error comes when calling dir(). I have the same problem with
ls();
I have tried this on 5 different FTP servers with the same result.
Any insights would be appreciated.
##### begin script ######
#! /usr/bin/perl -w
use strict;
use Net::FTP;
# Config variables
my $host = 'ftp.netscape.com';
my $dir = 'pub/';
my $user = 'anonymous';
my $pass = 'me@here.com';
my $ftp;
$ftp = Net::FTP->new($host) || die "Net::FTP failed: $!"
$ftp->message;
print $ftp->message;
$ftp->login($user, $pass) || die "login: $!" . $ftp->message;
print $ftp->message;
$ftp->cwd($dir) || die "cwd: $!" . $ftp->message;
print $ftp->message;
# this is where the error occurs
my $files = $ftp->dir();
print $ftp->message;
$ftp->quit;
foreach (@$files) {print "$_\n" }
####### end script ########
gus
------------------------------
Date: Wed, 28 Apr 1999 20:00:10 -0500
From: Richard Brandt <richb@ezl.com>
Subject: Re: Net::FTP Invalid Port Command
Message-Id: <3727AF1A.78F287FD@ezl.com>
Gus,
I've had problems like this in the past, don't recall the error
message, and discovered it was due to a firewall in front the FTP server
I was getting files from. All commands except for dir, ls and get worked
flawlessly. When a ls, dir or get command was sent the firewall/proxy
accepted the commands but didn't return the results thus hanging the
process. I resolved the problem by working with the firewall/proxy
folks.
Good Luck!
Rich
Gus wrote:
> Hi,
>
> In trying to use Net::FTP with the code below, I get a response back
> from the FTP server saying either "Invalid Port Command" or "Port
> argument must be 1025 or greater" ( it seems to depend on which
> netscape ftp server picks up the request).
>
> The error comes when calling dir(). I have the same problem with
> ls();
>
> I have tried this on 5 different FTP servers with the same result.
> Any insights would be appreciated.
>
> ##### begin script ######
> #! /usr/bin/perl -w
> use strict;
> use Net::FTP;
>
> # Config variables
> my $host = 'ftp.netscape.com';
> my $dir = 'pub/';
> my $user = 'anonymous';
> my $pass = 'me@here.com';
> my $ftp;
>
> $ftp = Net::FTP->new($host) || die "Net::FTP failed: $!"
> $ftp->message;
>
> print $ftp->message;
>
> $ftp->login($user, $pass) || die "login: $!" . $ftp->message;
> print $ftp->message;
>
> $ftp->cwd($dir) || die "cwd: $!" . $ftp->message;
> print $ftp->message;
>
> # this is where the error occurs
> my $files = $ftp->dir();
> print $ftp->message;
>
> $ftp->quit;
>
> foreach (@$files) {print "$_\n" }
>
> ####### end script ########
>
> gus
------------------------------
Date: Wed, 28 Apr 1999 13:47:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: NewBie: using If statment with multiple expressions
Message-Id: <9jh7g7.gu.ln@magna.metronet.com>
Dennis (dennis@rietvink.demon.nl) wrote:
: Can anyone give me a hint how i can use multiple expressions in a if
: statement, like:
: if ( value = 1 OR value = 2 OR value = 3 ) then....
How's this?
if ( $value = 1 or $value = 2 or $value = 3 )
Although I am certain that that is not what you really
want to do though (because the condition is *always* true).
perl will tell you what is wrong with it if you have
warnings enabled (which you should do on every single
Perl program)
We are not here to read the docs to you.
Go away. Learn the most rudimentary things about Perl,
then come back.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 29 Apr 1999 00:11:06 GMT
From: "Stephen Warren" <swarren@slip.net>
Subject: Re: part of a variable
Message-Id: <usNV2.4316$gv5.2278@news.rdc1.sfba.home.com>
Larry Rosler <lr@hpl.hp.com> wrote in message
news:MPG.11911731a534ef9c98996c@nntp.hpl.hp.com...
> In article <372772b8.23021445@news.enteract.com> on Wed, 28 Apr 1999
> 20:43:55 GMT, Steve . <syarbrou@nospam.enteract.com> says...
> > I have a variable called QUESTION72. I want to check to see if the
> > variable starts with QUESTION and if so, find out what the number is
> > after it. The number can change to anything. Not just two
> > characters. How would I go about doing this? Thanks.
>
> Don't even think of doing this. That is one of the many things that
> hashes are useful for.
Good advice, but should you want to run a consistency check on the data
stored in $questions{"72"} to ensure that you 'coding standard' for question
text was followed, you could:
$qnum = "72" ;
$questions{qnum} =~ m/^QUESTION(\d+)/ ;
print "valid\n" if $1 eq qnum ;
------------------------------
Date: Wed, 28 Apr 1999 17:52:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: part of a variable
Message-Id: <MPG.11914d192e505207989971@nntp.hpl.hp.com>
In article <usNV2.4316$gv5.2278@news.rdc1.sfba.home.com> on Thu, 29 Apr
1999 00:11:06 GMT, Stephen Warren <swarren@slip.net> says...
>
> Larry Rosler <lr@hpl.hp.com> wrote in message
> news:MPG.11911731a534ef9c98996c@nntp.hpl.hp.com...
> > In article <372772b8.23021445@news.enteract.com> on Wed, 28 Apr 1999
> > 20:43:55 GMT, Steve . <syarbrou@nospam.enteract.com> says...
> > > I have a variable called QUESTION72. I want to check to see if the
> > > variable starts with QUESTION and if so, find out what the number is
> > > after it. The number can change to anything. Not just two
> > > characters. How would I go about doing this? Thanks.
> >
> > Don't even think of doing this. That is one of the many things that
> > hashes are useful for.
>
> Good advice, but should you want to run a consistency check on the data
> stored in $questions{"72"} to ensure that you 'coding standard' for question
> text was followed, you could:
>
> $qnum = "72" ;
> $questions{qnum} =~ m/^QUESTION(\d+)/ ;
$qnum
> print "valid\n" if $1 eq qnum ;
== $qnum
The quotes around the numbers are superfluous, unless you want to do
things like force leading zeros.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 28 Apr 1999 23:43:38 GMT
From: "Stephen Warren" <swarren@slip.net>
Subject: Re: Simple if syntax Question
Message-Id: <K2NV2.4310$gv5.2383@news.rdc1.sfba.home.com>
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.net> wrote in
message news:3726F6F8.2A3E7A0D@gmx.net...
> morti_cne@my-dejanews.com wrote:
> >
> > if ($FORM{'TEAM'} = 'Component') {
> > $data_file = "component.db";
> > }
> > if ($FORM{'TEAM'} = 'System') {
> > $data_file = "system.db";
> > }
>
> There's also elsif, you know
I haven't seen all the thread, but there's always:
$data_file = $fileOfTeam{ $FORM{ 'TEAM' } } ;
(but you may want to 's/ //g' to satisfy some coding standards...
------------------------------
Date: 28 Apr 1999 19:56:38 -0400
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Simple one?
Message-Id: <m3iuagti2x.fsf@joshua.panix.com>
Jonathan Feinberg <jdf@pobox.com> writes:
> Looks like a bug. I have reported it using perlbug.
Well, if you're going to make an ass out of yourself, make sure to do
so as loudly as possible. Make sure to broadcast your ignorance to an
audience best equipped to discern it and correct it.
As many, many members of the p5p list have pointed out to me, it's a
feature.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Wed, 28 Apr 1999 17:30:59 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Simple one?
Message-Id: <3727A843.AB243669@mail.cor.epa.gov>
Jonathan Feinberg wrote:
>
> Jonathan Feinberg <jdf@pobox.com> writes:
>
> > Looks like a bug. I have reported it using perlbug.
>
> Well, if you're going to make an ass out of yourself, make sure to do
> so as loudly as possible. Make sure to broadcast your ignorance to an
> audience best equipped to discern it and correct it.
Welcome to the club. Who still here in this ng hasn't done
something analogous?
[And before some people fib, remember there's DejaNews. :-]
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Wed, 28 Apr 1999 17:02:43 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: strange problem with the month from a date!!
Message-Id: <3727A1A3.B6FB0177@mail.cor.epa.gov>
Bradley W. Langhorst wrote:
>
> 0 based array?
> 0 = jan
> 1= feb
> ...
>
> ??
> brad
All arrays are `zero-based' in Perl, unless you do something
deprecated. But the numbers for month come from a C struct tm,
and similarly start at 0 and work their way up. But this lets
you say nice things like:
@months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
print $months[$mon], "\n";
when you pulled $mon from localtime().
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Thu, 29 Apr 1999 00:34:03 GMT
From: NOSPAMcrstlblu@planet.eon.net
Subject: Re: stupid single quote " wipes out REST OF TEXT
Message-Id: <371bb76e.1617532@news.planet.eon.net>
On Wed, 28 Apr 1999 08:39:35 -0400, tadmc@metronet.com (Tad McClellan) wrote:
> STOP POSTING YOUR HTML PROBLEMS IN THE PERL NEWSGROUP!!!
> *plonk*
> $value =~ s/"/"/g; # escape double quotes as REQUIRED
> # by the HTML specification!!!
> Tad McClellan
thanks for your suggestion, Tad, however it doesn't work!
foreach $item(@pairs) {
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~ s/"/"/d; > > TRIED YOUR IDEA HERE AND GOT AN ERROR
$content=~ s/%(..)/pack("c",hex($1))/ge;
$fields{$key}=$content;
}
I have aslo tried content=~tr/"/"/d; never got an error, but still
lost the 200 characters after the single quote in the value of the text string
again, in the 1st cgi script the variable was:
$value = $dbhash{dbkey{'thevalue'}};
where 'thevalue' = "200 characters, 5'10", followed by 200 more"
passed to the 2nd cgi script in a hidden field:
<input type=\"hidden\" name=\"samevariable\" value=\"$value\">
PARSED as in my example parser above, and several ways
ALWAYS loses the QUOTATION mark in middle & the 200 chars following it!
escaping BEFORE entering the $value into the hidden field would be
insane, because then I'd be CHANGING the value, which is NOT MY RIGHT,
as that text was typed in by a customer, and stored in a DBM.
escaping AFTER parsing the values in the 2nd script seems insane,
because I'd be changing the value, when I might want to RE-save it to another
DBM in the remainder of the script!
it's NOT A MATTER OF HTML friend, the PROOF is that in the FIRST cgi
script, when the value of $value is: "200 chars, 5'10", and 200 chars" NO QUOTE
ESCAPE IS NECESSARY IN ORDER for $value to be printed PERFECTLY!
*note: the script declares the variable as from a DBM file
$value=$dbhash{$dbkey{'thevalue'}};
"200 chars, 5'10", and 200 chars" is simply WHAT IS IN THE DBM, it is
NEVER WRITTEN in the script - SILLY.
so if it works WITHOUT escapeing in the 1st script, WHY would it require
escaping in the 2nd script? this is ILLOGICAL!
even **MORE PROOF** is that no quote escaping of anysort was required in
the OTHER 3 scripts which 1) collected the input, 2) displayed PERFECTLY for
confirmation, and 3) entered the text into a DBM file - PERFECTLY!
the $value is being passed EXACTLY THE SAME WAY from script to script to
script in BOTH APPLICATIONS!?!?!?!?!?
app1: 1) collects text string / 2) displays to confirm / 3) puts in DBM
app2: 1) extracts & DISPLAYS from DBM / 2) displays AGAIN to confirm
THE PRECISE SAME HTML SPECIFICATIONS ARE BEING USED IN BOTH APPLICATIONS
? :)
but i keep LOSING both the quotation PLUS the 200 chars following it FROM THE
value of the variable when it gets parsed AND printed by the 2nd script.
This is my last attempt to have a PracticalExtractionandReportLanguage question
answered in this PERL newsgroup - thanks for all of your time,
wj
remove SPAM from email to reply
------------------------------
Date: Wed, 28 Apr 1999 16:43:48 -0400
From: "Steven T. Hatton" <hattons@cpkwebser5.ncr.disa.mil>
Subject: test please ignore
Message-Id: <37277304.12CC58E8@cpkwebser5.ncr.disa.mil>
So you didn't listen
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5512
**************************************