[9591] in Perl-Users-Digest
Perl-Users Digest, Issue: 3185 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 17 11:28:03 1998
Date: Fri, 17 Jul 98 07:01:41 -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 Fri, 17 Jul 1998 Volume: 8 Number: 3185
Today's topics:
[??] local %ENV then open(...) boubaker@dgac.fr
Re: Calling up a gif within the return html of a perl s <mastered@paclink.com>
Callling Perl script from Java app <simon@new-mediacom.com>
Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. p <pgunn01@ibm.net>
FTP between two Unix machines <WouterR@xedv.cdcgate.dupont.com>
Re: Help with perl script. on editing a database file <stephan@spartacus.unilog.se>
Re: matching problem <quednauf@nortel.co.uk>
Re: MIME types <quednauf@nortel.co.uk>
Re: More musing on -w (M.J.T. Guy)
Re: my $country = @_; # right or wrong? <chris.wareham@blackwell.co.uk>
Re: newbie date format <stephan@spartacus.unilog.se>
Re: newbie date format <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: newbie date format <quednauf@nortel.co.uk>
Re: open (IN, "foo.txt") works, open (IN, "$foo") does <jdf@pobox.com>
Re: open (IN, "foo.txt") works, open (IN, "$foo") does <maierc@chesco.com>
Premature End of Script Header problem <mastered@paclink.com>
Re: Premature End of Script Header problem <flavell@mail.cern.ch>
Re: print<<"xxx" vs. print fred@no.spam.leeds.ac.uk
Re: print<<"xxx" vs. print (Kevin Reid)
Re: Problem writing an output file <amorri1@pop.sunalliance.com>
Question concerning autoflush <joreb@algonet.se>
Reliability of random numbers <hamilton@melbpc.org.au>
Reverse an associative array <qmwclka@emw.ericsson.se>
Re: Reverse an associative array (Aaron B. Dossett)
Re: Reverse an associative array <qdtcall@esb.ericsson.se>
Re: running C functions in PERL <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: sending login/pass to httpd authentication via perl fred@no.spam.leeds.ac.uk
Re: Silly things to do in Perl (or: is that Laptop wate <quednauf@nortel.co.uk>
Re: SQL INFORMIX DATABASE <r.goeggel@atos-group.de>
Re: unwanted warning <rra@stanford.edu>
URGENT: HELP!!!! <dominique.cretel@cfwb.be>
Re: when i use htaccess to do authentication <stephan@spartacus.unilog.se>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Jul 1998 09:01:27 GMT
From: boubaker@dgac.fr
Subject: [??] local %ENV then open(...)
Message-Id: <6on3t7$7uu$1@nnrp1.dejanews.com>
hi perl gurus,
This doesn't seems to be a FAQ (at least I do not found any clues anywhere).
From a perl script I'm trying to launch another script w/ open but I want to
set my own ENV for this script, but setting ENV after redeclaring it as local
doesn't seems enough for open:
---8x-----try-it.pl----
#!/usr/local/bin/perl
my $level = $ARGV[0];$level++;
exit if $level > 2;
sub printenv {
while ( my ($k, $v) = each %ENV ) {
print "$level> $k \t=> \t$v\n";
}
}
my %MY_ENV = ( 'MY_K1' => 'K1_VAL' );
# here %ENV contain the values of environ
printenv;
{
local %ENV = %MY_ENV;
# here %ENV contain the values of %MY_ENV
# which is the expected behavior
printenv;
open( ENVX, "$0 $level |" ) or die "$0 $level | ... BOOM!";
# the %ENV printed here is NOT the value contained
# in the `local' %ENV
while ( <ENVX> ) {
print;
}
close ENVX;
}
#---end of try-it.pl -------
Instead of doing that what I need to do is:
{
my ($k, $v);
foreach $k ( keys %ENV ) {
delete $ENV{ $k };
}
while ( my ($k, $v) = each %MY_ENV ) {
$ENV{ $k } = $v;
}
# ...
open ...
}
Why !!!! why redeclaring ENV as local in a block do not work as expected w/
open !!! is it a bug, a feature or something I misunderstood ?
regards
- heddy -
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 17 Jul 1998 04:53:14 -0700
From: David Hemmer <mastered@paclink.com>
To: sowmaster@juicepigs.com
Subject: Re: Calling up a gif within the return html of a perl script.
Message-Id: <35AF3B29.229B5466@paclink.com>
I actually have the same problem but I fixed it by _not_ using quotes in
my address of the graphic file so it looks like
<img src=$graphic>
(note the $graphic is grabbed from a database file)
I keep getting errors when I try to put the quotes in and the program
keeps trying to evaluate everything in between. My solution is probably
the wrong one but it works so far for me.
Dave Hemmer
'rainman'
Mastered Media Productions
visionaryone@unforgettable.com
Bob Trieger wrote:
> Not mailed due to assenine address munging.
>
> "Racso" <racso1983@SPAMLESS.mainsite.com> wrote:
> -> I have searched through the FAQ and spent a number of hours
> -> over on Deja News looking for the answer to my question, but
> -> with no luck.
>
> >>> snip <<<
>
> This is an HTML question, not perl, nor even CGI.
>
> Why not
> print '<IMG SRC="http://your.address.com/your.gif">';
>
> Bob Trieger
> sowmaster@juicepigs.com
> " Cost a spammer some cash: Call 1-800-400-1972
> Ext: 1949 and let the jerk that answers know
> that his toll free number was sent as spam. "
------------------------------
Date: Fri, 17 Jul 1998 09:18:47 +0100
From: Simon Wistow <simon@new-mediacom.com>
Subject: Callling Perl script from Java app
Message-Id: <645CAC0140CED111AF1500805FEDDB8A4F5B@ns.new-mediacom.co.uk>
I'm currently writing some back end scripts for my company that takes
results from a Java game and emails a challenge to another person.
Currently my script takes the email addresses and names of the
challenger and challenged and a message from the game using POST and
this has been tested using a web page with forms in it that simulates
the presence of the game. The reason I am using the POST method is
because it makes it that little bit harder for someone to use the script
as an anonymous emailer.
However the guy who is doing the Java coding has come up to me and asked
me how he writes to the STDIN of my script and, being a total Perl
newbie, I have no idea. Have any of you got any ideas or am I going to
have use GET and a work around (authenticate the sender/encode the
data/etc)?
Cheers
------------------------------
Date: Fri, 17 Jul 1998 06:27:59 -0400
From: Pat Gunn <pgunn01@ibm.net>
Subject: Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. print)
Message-Id: <35AF272F.5A65@ibm.net>
Putting on my dunce cap :)
> all of the questions have very short answers (about one word each) which,
> hopefully, will open exploration of large areas of programming terra
> incognita. the bonus answer is cute and copyrighted by me.
>
> 1. Who is main the PERSON you should think about while you are writing code?
Me
> 2. Other than comments, what is the most important HUMAN aspect of code?
Easy to write :)
> 3. What is the main PURPOSE of comments?
Help me know what I'm doing at least until I'm done doing it
> Bonus: What is the OPPOSITE of spaghetti code?
jello code!
--
---------------------------------------------------
Pat Gunn, moderator:comp.sys.newton.announce
comoderator:comp.os.os2.moderated
"You can always judge a man by the quality of his enemies." -- Dr Who
http://junior.apk.net/~qc
------------------------------------------------
------------------------------
Date: Fri, 17 Jul 1998 14:00:29 +0200
From: "Ronald Wouters" <WouterR@xedv.cdcgate.dupont.com>
Subject: FTP between two Unix machines
Message-Id: <6onefu$95v@topgun.es.dupont.com>
Hi all,
I need to write a perl script that will FTP files between a development
machine and the production machine. Can anyone point me to an URL or other
documentation on how to do this. Code examples are also welcome.
Regards,
Ronald Wouters
Email: ronald.woutersNOSPAM@bel.dupont.com
------------------------------
Date: Fri, 17 Jul 1998 15:08:08 +0200
From: Stephan Lagerholm <stephan@spartacus.unilog.se>
Subject: Re: Help with perl script. on editing a database file
Message-Id: <35AF4CB8.CC4F4210@spartacus.unilog.se>
andrew_broadley@my-dejanews.com wrote:
>
> Hi,
>
> I've designed a script, where u can submit to and search a database file.
>
> Yet i can not figure out how to edit the file, tried using arrays but couldnt
> figure it out.
>
> The script needs to be able to edit the file.
>
> The layout of the file is
>
> name|company|phone| etc
>
> or if there is any other way of editing it
>
> Allinfo would be helpful
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
What database do you use ?
------------------------------
Date: Fri, 17 Jul 1998 14:17:58 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: matching problem
Message-Id: <35AF4F06.4115A273@nortel.co.uk>
Simon Dueckert wrote:
>
> Now I want to split it in 3 variables. I did the following (I'm new to
> perl ;^)
>
> script:
>
> #!/usr/bin/perl
>
> open INFO,"test.txt"
> while ($line=<INFO>)
> {
> print $line; --> this works fine
> ($file,$desc,$url)=(/^(\s)()(\s)$/); -->probably this looks
> very strange to you
> print $file; -->no output
> }
Hmmm, that doesn't make much sense.
$_ = 'test.txt Text to Test http://www.microsoft.com';
/^(.+?)\s(.+)\s(http:.+)/;
print join('--', $1, $2, $3);
Gives: test.txt--Text to Test--http://www.microsoft.com
Above regexp matches. But you're making your own life harder than you
need. What if your link starts with ftp ? If you can separate the
entries by some distinct character, you can do the whole thing with
split:
$_ = 'test.txt|Text to Test|http://www.microsoft.com';
@pieces = split /\|/;
print join('**', @pieces);
Gives: test.txt**Text to Test**http://www.microsoft.com
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Fri, 17 Jul 1998 12:05:23 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: MIME types
Message-Id: <35AF2FF3.4F956001@nortel.co.uk>
ku@my-dejanews.com wrote:
MIME types are a specification issue, regardless of the programming
language you use them in. Please check the relevant documentation which
can be found on the web. A tip is to check the MIME types defined in
your web browser, which gives you an insight on how the MIME type header
is written.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 17 Jul 1998 11:14:50 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: More musing on -w
Message-Id: <6onbna$ctg$1@pegasus.csx.cam.ac.uk>
Alan Barclay <gorilla@elaine.drink.com> wrote:
>
>Yes, I know this, but that tells you the line the error occured, I
>was using 'source' meaning the compiler, the interpeter, a warn
>statement or a carp statement. I know of no way of knowing this.
You can use $^S to find whether or not you are currently compiling.
And the other cases can be distinguished by analysing the caller()
stack, e.g. by looking for Carp.pm.
Mike Guy
------------------------------
Date: Fri, 17 Jul 1998 13:38:22 GMT
From: Chris Wareham <chris.wareham@blackwell.co.uk>
Subject: Re: my $country = @_; # right or wrong?
Message-Id: <35AF5469.87E5F4D@blackwell.co.uk>
# It could be that Larry and the boys are New Model Army fans ...
#!/usr/bin/perl
print <<NMA;
MY PEOPLE
Stare across the crowd, the fear and love in their faces
The children of the tribes, prisoners of the flag unfurling
Protext us in these changing times,
The warm embrace, the killing price ...
My people right or wrong
Remember running from the hall as the voices screamed behind us
I felt I'd die for you in the sunlit hills of our home
The moments come and then reced away
The empty words, the hollow light of day ...
My people right or wrong
And outside is cold
Staring up at the bitter home
The thicker the blood the faster it keeps on flowing
Get in your place boy
Let's take what's ours, boy
Understand the price, boy
I've seen those who try to make a life without kin forever
So I've taken my place uncertain at your shoulder
The last few prayers, the whistle blow,
And into the fray once more we go
My people right or wrong
NMA
__END__
Chris
--
chris.wareham@blackwell.co.uk
+44 (0)1865 792792 ext. 3381
http://www.killingmiranda.pair.com/
------------------------------
Date: Fri, 17 Jul 1998 10:08:51 +0200
From: Stephan Lagerholm <stephan@spartacus.unilog.se>
Subject: Re: newbie date format
Message-Id: <35AF0693.6C3D64CF@spartacus.unilog.se>
F.Quednau wrote:
>
> Jan Lattunen wrote:
>
> > My problem is rather simple.
>
> Hmmm...
>
> > I've been trying to get the
> > date in a format like yyyy-mm-dd like 1998-07-16
> > closest i've got so far is like 98-7-16.
>
> Darn close, innit ? :)
>
> 98 + 1900 = 1998
>
> See first grade maths books
>
> printf("%.2d",7); # gives 07
>
> See man printf
>
> --
> ____________________________________________________________
> Frank Quednau
> http://www.surrey.ac.uk/~me51fq
> ________________________________________________
What happens after 2000 ?
I would use:
#!/usr/bin/perl -w
use strict;
my($date);
open(DATE,"/usr/bin/date +%Y-%m-%d |") || die"can't open:$!";
$date=<DATE>;
chomp($date);
print"Today is: $date\n";
------------------------------
Date: 17 Jul 1998 14:33:56 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: newbie date format
Message-Id: <7xoguod5cb.fsf@fidelio.vcpc.univie.ac.at>
Re: newbie date format, Stephan
<stephan@spartacus.unilog.se> said:
>> Jan Lattunen wrote:
>>
>> > I've been trying to get the > date in a format like
>> yyyy-mm-dd like 1998-07-16 > closest i've got so far is
>> like 98-7-16.
>>
Stephan> #!/usr/bin/perl -w
Stephan> use strict; my($date); open(DATE,"/usr/bin/date
Stephan> +%Y-%m-%d |") || die"can't open:$!"; $date=<DATE>;
Stephan> chomp($date); print"Today is: $date\n";
Yuk! ++$invent{wheel}; :-)
my $datestr = POSIX::strftime(..., localtime);
perldoc POSIX
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
personal email: tony_curtis32@hotmail.com
"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.
------------------------------
Date: Fri, 17 Jul 1998 13:54:35 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: newbie date format
Message-Id: <35AF498B.9BF23021@nortel.co.uk>
Stephan Lagerholm wrote:
_______________________________
> What happens after 2000 ?
1900 + 100 = 2000
See First grade maths books.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 17 Jul 1998 08:07:53 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Juergen.Puenter@materna.de (J|rgen P|nter)
Subject: Re: open (IN, "foo.txt") works, open (IN, "$foo") does not???
Message-Id: <g1g0ocba.fsf@mailhost.panix.com>
Juergen.Puenter@materna.de (J|rgen P|nter) writes:
> $file4 = #choose your method to put together $file2 and $file3#
> open (FHIN, "$file4") || die "...";
You're omitting the only important parts of the sample code. How can
we possibly evaluate what's going wrong if you leave those things out?
If you can post a *brief* but *complete* program that demonstrates this
behavior, please do.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Fri, 17 Jul 1998 13:33:11 GMT
From: Charles Maier <maierc@chesco.com>
Subject: Re: open (IN, "foo.txt") works, open (IN, "$foo") does not???
Message-Id: <35AF5384.538D@chesco.com>
Matthew O. Persico wrote:
>
> Suggestion, maybe for the FAQ:
>
> Whenever a statement ceases to work because of the substitution of a
> variable for a constant, do this BEFORE asking the question, "Why
> doesn't this work:
>
> print "\n\n|$TheBadVar|\n\n";
>
> That will certainly help find the non-chomped \n in the variable. It
> might also find trailing/leading spaces, etc. If the |'s aren't cuddled
> up to the value of the var, you've got extra stuff.
or even "CaSe" ????
--
Chuck Maier
CDM Consulting Services
http://www.cdmcon.com
(610) 943-2726
------------------------------
Date: Fri, 17 Jul 1998 04:39:01 -0700
From: David Hemmer <mastered@paclink.com>
Subject: Premature End of Script Header problem
Message-Id: <35AF37D5.A72EFF7E@paclink.com>
This script I have comes out ok when I 'perl -c status.cgi' it and it
outputs what it is supposed to when I run it as 'perl status.cgi' but
when I try running it through a web browser, it kicks back with Internal
Server Error and the error log says it died because of a premature end
of script header. Anyone wanna give me a clue as to what I am missing
here, cause I just can't seem to find it.
#/usr/bin/perl
require("cgi-lib.pl");
$database = "./status.db";
$tmpl_file = "./results.tmpl";
open (DATABASE, "$database") || die "Content-type: text/html\n\nI'm
sorry, I cannot open the database!";
@database = <DATABASE>;
close(DATABASE);
foreach (@database) {($status, $date, $staff, $msg) = split (/::/);
$matched .="<HR><img src=$status><br>$date<br>$staff<br>$msg\n"
};
open (TEMPLATE, "./$tmpl_file") || die "Content-type: text/html\n\nI'm
sorry, I can't open the template file!";
@template = <TEMPLATE>;
close(TEMPLATE);
$template[6] =~ s/XXXX/$matched/e;
print "Content-type: text/html\n\n";
print @template;
and the template file looks like this:
<html>
<head>
<Title>Paclink Status Page</title>
</head>
<body background="FFFFFF">
<H1>Paclink System Staus Page</H1>
XXXX
<HR>
</body>
</html>
Thanks
Dave Hemmer
'rainman'
visionaryone@unforgettable.com
mastered@paclink.com
------------------------------
Date: Fri, 17 Jul 1998 13:59:10 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Premature End of Script Header problem
Message-Id: <Pine.HPP.3.95a.980717134852.21241A-100000@hpplus06.cern.ch>
On Fri, 17 Jul 1998, David Hemmer wrote:
> This script I have comes out ok when I 'perl -c status.cgi' it and it
> outputs what it is supposed to when I run it as 'perl status.cgi' but
> when I try running it through a web browser, it kicks back with Internal
> Server Error and the error log says it died because of a premature end
> of script header. Anyone wanna give me a clue as to what I am missing
Well, you've missed:
[X] The fault symptoms you've reported here are pretty much the same as
every other newbie CGI fault report, i.e they do little more than prove
that you have a problem, but don't contain even one detail that would
help. WHAT'S THE SERVER'S ERROR LOG SAY, damnit?
[X] This appears to be a CGI question, not a perl language question,
so it probably belongs on the CGI group.
These newbie questions mean you haven't started to debug the problem,
nor worked your way down the "idiot's guide to CGI debugging" FAQ, and
therefore you aren't yet ready to ask the combined forces of usenet a
meaningful question about your specific CGI problem. When you are, I
suggest you do it on the comp.infosystems.www.authoring.cgi group.
There might be a point at which you'd need to provide the relevant bit
of your code in order to assist diagnosis, but splattering the whole
thing into a posting isn't usually very productive. Unless someone's
feeling unusually charitable, but this is usenet, after all. :-}
good luck
------------------------------
Date: Fri, 17 Jul 1998 10:28:28 +0100 (BST)
From: fred@no.spam.leeds.ac.uk
Subject: Re: print<<"xxx" vs. print
Message-Id: <35AF8A25.3AF7@no.spam>
> Otherwise they are equivalent, so no flames. If anything, the 'qq{'
> form is slightly more flexible, because of the trailing new-line issue.
Yes. I have never really understood why the last newline (which must be
there, mustn't it, because the need for the end delimiter to start on
a newline) is considered to be part of the document.
Is there any possibility of a Perl changing its interpretation of here
documents to ignore the last newline? Or can I do an explicit chomp
somewhere?
Ben.
------------------------------
Date: Fri, 17 Jul 1998 09:40:42 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: print<<"xxx" vs. print
Message-Id: <1dcb0ff.1j5a290w97q65N@slip-32-100-246-66.ny.us.ibm.net>
<fred@no.spam.leeds.ac.uk> wrote:
> > Otherwise they are equivalent, so no flames. If anything, the 'qq{'
> > form is slightly more flexible, because of the trailing new-line issue.
>
> Yes. I have never really understood why the last newline (which must be
> there, mustn't it, because the need for the end delimiter to start on
> a newline) is considered to be part of the document.
It makes more sense for print statements.
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Fri, 17 Jul 1998 12:16:16 +0100
From: "Alan Morris" <amorri1@pop.sunalliance.com>
Subject: Re: Problem writing an output file
Message-Id: <6on9bj$6mq2@extnews.sunalliance.com>
>Hmm. You're saying ">>C:\\foo\\bar\\baz" doesn't work? It should. I
>think. Maybe you should post some examples that fail.
>_____________________________________________________________________
>Steve Linberg National Center on Adult Literacy
>Systems Programmer &c. University of Pennsylvania
>linberg@literacy.upenn.edu http://www.literacyonline.org
Steve, you've fixed my problem - I wasn't using the double slashes as you
put in your example !
The output file is going where I need it to now.
Thanks for coming back.
------------------------------
Date: 17 Jul 1998 08:04:35 GMT
From: "Ekenberg" <joreb@algonet.se>
Subject: Question concerning autoflush
Message-Id: <01bdb159$87c9d8c0$7c9264c3@w95>
I'm just beginning my voyage through the Camel-lands and have a basic
question:
I found a very simple webpage-counter-script that, apart from saving the
number of hits in a file, simply returns a few
<IMG SRC="foo/bar/x.gif">
to the calling shtml-page. At the top of the script, the author had enabled
autoflushing, like so:
$| =1;
My question is why this was added? Does it make any difference?
Thanks for enlightening a Perl-beginner :)
/Johan E
------------------------------
Date: Fri, 17 Jul 1998 19:51:59 +1000
From: David Hamilton <hamilton@melbpc.org.au>
Subject: Reliability of random numbers
Message-Id: <35AF1EBE.54AAC50E@melbpc.org.au>
Can someone who has been working with Perl for a while tell me whether
the following code is "trustworthy" for giving out a random number, or
is it prone to one number or another:
srand(time ^ $$);
$a=int(rand(15))+1;
Thanks.
------------------------------
Date: Fri, 17 Jul 1998 14:32:16 +0100
From: Clas <qmwclka@emw.ericsson.se>
Subject: Reverse an associative array
Message-Id: <35AF5260.333CE2E@emw.ericsson.se>
Hello!
I am a beginner...
My task is to reverse an associative array.
Say I've got an array like this:
%ages = ("Angie ", 39,
"Dirty ", 34,
"Michael ", 27,
"Willy ", 21 );
How should I do to reverse this?
So Willy will be the first name in the associative array.
------------------------------
Date: 17 Jul 1998 13:34:49 GMT
From: aarond@alpha.ewl.uky.edu (Aaron B. Dossett)
Subject: Re: Reverse an associative array
Message-Id: <6onjtp$lc$1@service3.uky.edu>
Clas (qmwclka@emw.ericsson.se) wrote:
>
> How should I do to reverse this?
> So Willy will be the first name in the associative array.
Eh? Associative arrays, or hashes, don't really have an order in that
sense. When you say you should 'reverse' the array are you sure that
doesn't mean flipping the values so the keys become the values and
vice versa?
--
Aaron B. Dossett | Finger aarond@london.cslab.uky.edu for PGP key
dossett@bigfoot.com|
Comp. Sci. Senior | http://www.ewl.uky.edu/~aarond
University of Kentucky 1996 & 1998 NCAA Basketball Champions
------------------------------
Date: 17 Jul 1998 15:35:03 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Reverse an associative array
Message-Id: <isyatsha7s.fsf@godzilla.kiere.ericsson.se>
Clas <qmwclka@emw.ericsson.se> writes:
> So Willy will be the first name in the associative array.
You have greatly misunderstood hashes (i.e., associative arrays). They
are not an ordered datatype. There is no such thing as a first item in
a hash. If you want to order your data, sort it and put it into an array.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: 17 Jul 1998 11:52:13 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: running C functions in PERL
Message-Id: <7xr9zkdctt.fsf@fidelio.vcpc.univie.ac.at>
Re: running C functions in PERL, Boris <bqd0915@is.nyu.edu>
said:
Boris> I need to perform a few API calls on HPUX 10.20
Boris> platform to something called Essbase Server. If I
Boris> have all the include files (lib*.h) as well as all
Boris> the library files (lib*.sl and lib*.a) documented,
Boris> can I somehow call them from PERL? I have done the
Boris> same in C but am wondering if it can be done in PERL.
perldoc perlxs
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.
------------------------------
Date: Fri, 17 Jul 1998 10:45:44 +0100 (BST)
From: fred@no.spam.leeds.ac.uk
Subject: Re: sending login/pass to httpd authentication via perl
Message-Id: <35AF8E31.7ADA@no.spam>
> ... Like any files protected by this, when you load the page it
> prompts you for a login and password in the authentication dialogue
> box. However, is there a way that I could send this information
> to the authentication scheme using a perl script so that this
> login/password dialog box DOESN'T need to be displayed?
If this is possible, it would likely be done by adding information
to the HTTP request header. You may find details in one of the
HTTP RFCs.
Ben.
------------------------------
Date: Fri, 17 Jul 1998 13:59:45 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Silly things to do in Perl (or: is that Laptop waterproof?)
Message-Id: <35AF4AC1.A7890184@nortel.co.uk>
Jonathan Stowe wrote:
>
> >> Oh *shish*, you're all a bunch of perfectionists :)
> >
> >That's *sheesh*, not *shish*. :)
> >
> A right kebabing if I ever saw one.
Neither Websters dictionary nor the jargon file tell me what that is
supposed to mean. HELP!
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Fri, 17 Jul 1998 13:42:49 +0200
From: "Ronald Gvggel" <r.goeggel@atos-group.de>
Subject: Re: SQL INFORMIX DATABASE
Message-Id: <6onddb$e7g$1@news.pop-stuttgart.de>
Edward Villalovoz schrieb in Nachricht <35a5b200.0@blushng.jps.net>...
>Can anyone tell me how to convert this csh script to perl? I would
rather
>not use any add-ons like dbi. Thanks.
>
>#!/bin/csh
>
>setenv INFORMIXSERVER n36_shm
>dbaccess << eof
<snip>
eof
>
$ENV{INFORMIXSERVER} = 'n36_shm';
$command = <<eof
<snip>
eof
;
system("echo $command | dbaccess");
This is untested code.
HTH
Ronald
------------------------------
Date: 17 Jul 1998 00:55:48 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: unwanted warning
Message-Id: <m3pvf4oqrf.fsf@windlord.Stanford.EDU>
Stephan Lagerholm <stephan@spartacus.unilog.se> writes:
> I'm making some CGI's in perl and use the -w flag. My program uses a lot
> of dbm's but I don't want perl to open a new database if there doesn't
> exists any.:
> dbmopen(%AAA,"aaa",undef);
Try using 0 instead of undef; I believe the functionality is equivalent.
Although from my reading of perlfunc, I'm not sure if this does what you
want; it sounds like it should treat undef as a umask of 000 and create
the database anyway. But when I try it, it does indeed die with "file not
found" (with either undef or 0). Odd.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Fri, 17 Jul 1998 14:04:47 +0200
From: Dominique CRETEL <dominique.cretel@cfwb.be>
Subject: URGENT: HELP!!!!
Message-Id: <35AF3DDF.B57@cfwb.be>
Hi all,
I begin with Perl and I'm fighting with this problem:
I have a file which structure looks like this (see the and of the post):
an ID (a number),
a bloc of text (number of lines is variable)
one empty line of datas (may be with space or tab)
and so on...
I want to select only the entire blocs that contains the string
"Statement Text". For example, in the exemple a the end of the post, I
will get only the bloc:
---------
9483 DB2 api_data relation_data_serv sqlrrdi (1.15.18.6)
pid 208; tid 159; cpid 170; time 65325853; trace_point 11
P1: Statement Text =
SELECT * FROM NFUSER WHERE NFNAME= 'THEIZE01'
---------
How can I do that?
Thanks,
Dominique
---trace.log--------------------------
9482 DB2 cei_retcode oss 2
sqloCreateStaticDataAnchors> (1.23.74.109)
pid 561; tid 569; cpid 69; time 65325853; trace_point 254
return_code = 000000 = 0
9483 DB2 api_data relation_data_serv sqlrrdi (1.15.18.6)
pid 208; tid 159; cpid 170; time 65325853; trace_point 11
P1: Statement Text =
SELECT * FROM NFUSER WHERE NFNAME= 'THEIZE01'
9484 DB2 api_retcode base_sys_utilities sqleGetCurrentCtx
(1.13.76.106)
pid 561; tid 569; cpid 69; time 65325853; trace_point 254
return_code = 000000 = 0
-----------------------------
------------------------------
Date: Fri, 17 Jul 1998 11:46:42 +0200
From: Stephan Lagerholm <stephan@spartacus.unilog.se>
Subject: Re: when i use htaccess to do authentication
Message-Id: <35AF1D82.6D6AE14B@spartacus.unilog.se>
zhe dang wrote:
>
> when i use htaccess to do client authentication, how can a server know who
> (usrid and passwd)
> accesses the protected page?
user:
$user=$ENV{ 'REMOTE_USER' };
password:
For good reasons you can't get the password.
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3185
**************************************