[12349] in Perl-Users-Digest
Perl-Users Digest, Issue: 5949 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 10 14:07:17 1999
Date: Thu, 10 Jun 99 11:00:30 -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 Thu, 10 Jun 1999 Volume: 8 Number: 5949
Today's topics:
$_ in 5.004_04 vs 5.005_02 <fx77@dial.pipex.com>
Re: $_ in 5.004_04 vs 5.005_02 <fx77@dial.pipex.com>
Re: Acess databse access from unix with perl? <delete.the.nospam.kayec@gov.ns.ca>
Re: Acess databse access from unix with perl? (Scott McMahan)
Re: Binary File Uploading - Part 2 (I.J. Garlick)
Re: Binary File Uploading - Part 2 <emschwar@rmi.net>
Re: block inside print ? (Larry Rosler)
Re: block inside print ? <bill@fccj.org>
Re: Bulletin Board in Perl <cassell@mail.cor.epa.gov>
Re: can i variably name an array? <emschwar@rmi.net>
Re: Checking symlinks in Perl (Mark-Jason Dominus)
Re: Compile and IIS <rootbeer@redcat.com>
Re: Definition of words in Perl and POSIX (Larry Rosler)
Re: duplicate rows <rootbeer@redcat.com>
Re: duplicate rows <cassell@mail.cor.epa.gov>
Re: Error while running News-Scan-0.51 <h.c.a.bokhoven@bok.selwerd.cx>
Re: Examples, sources and tutorials (Jerome O'Neil)
Re: Executing adduser? Follow Up. <"tapplega--just remove this--"@utk.edu>
Re: filehandles in Win95 <jeff@vpservices.com>
Re: fork for DNS lookup - help <delete.the.nospam.kayec@gov.ns.ca>
hash table question <alain_chiorboli@email.sps.mot.com>
Re: Help on a news updating script I wrote... <rootbeer@redcat.com>
Re: How to sort an array of hashes by one of the hash f (Larry Rosler)
Re: Integer conversion problem (Larry Rosler)
Re: Integer conversion problem (M.J.T. Guy)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 10 Jun 1999 17:59:22 +0100
From: Technical Services - UK Link <fx77@dial.pipex.com>
Subject: $_ in 5.004_04 vs 5.005_02
Message-Id: <375FEEEA.6D282A21@dial.pipex.com>
I am using perl 5.004_04 HP-UX and 5.005_02 on SunOS and I get different
results from the same program, can anyone explain this to me?
Under 5.004_04 the following program prints: abc
under 5.005_02 it prints: hello
I am very confused, there is something different in the implementation
of $_ in both versions.
------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
use vars qw($abc);
$abc = 'abc';
for ($abc) {
#part of a case type statment
/abc/ and do {
$_ = 'hello';
last};
}
print "$abc\n";
------------------------------
Date: Thu, 10 Jun 1999 18:32:09 +0100
From: Technical Services - UK Link <fx77@dial.pipex.com>
Subject: Re: $_ in 5.004_04 vs 5.005_02
Message-Id: <375FF699.7D2543B6@dial.pipex.com>
Ignore this message. I have found the problem, due to a deliberate platform
dependency the program never reached the problem code under HP-UX
(5.004_04).
My apologies,
Technical Services - UK Link wrote:
> I am using perl 5.004_04 HP-UX and 5.005_02 on SunOS and I get different
> results from the same program, can anyone explain this to me?
>
> Under 5.004_04 the following program prints: abc
> under 5.005_02 it prints: hello
>
> I am very confused, there is something different in the implementation
> of $_ in both versions.
>
> ------------------------------------------------------------------
>
> #!/usr/bin/perl -w
>
> use strict;
>
> use vars qw($abc);
>
> $abc = 'abc';
> for ($abc) {
> #part of a case type statment
> /abc/ and do {
> $_ = 'hello';
> last};
> }
> print "$abc\n";
------------------------------
Date: Thu, 10 Jun 1999 13:43:28 -0300
From: "kayec" <delete.the.nospam.kayec@gov.ns.ca>
Subject: Re: Acess databse access from unix with perl?
Message-Id: <3WR73.1111$aP5.44859@sapphire.mtt.net>
In windows you setup an ODBC name (in this case its "branch") in the control
panel. I assume in Unix it's similar but i don't think you'll be able to
use your MS Access file on a Unix server.
Here is the code necessary to attach, read, close a database (for windows,
hopefully Unix is similar).
: )
PS if i'm wrong someone correct me.
=============================
sub openDB {
use Win32::ODBC; ### Use 32 bit ODBC Extensions (Canned Package)
if (!($custBranchDB = new Win32::ODBC("branch"))){
print "\nODBC Open BRANCH failed.\n";
&quitOut;
}
}
sub sendSQL {
if ($custBranchDB->Sql("SELECT * FROM Branch ORDER BY Name, Leader;")) {
print "Branch SQL failed";
&quitOut;
}
}
sub getData {
$custBranchDB->FetchRow();
($branch,$phone,$location) = $custBranchDB->Data;
while ($branch ne "") {
&printBranchInfo;
$custBranchDB->FetchRow();
($branch,$phone,$location) = $custBranchDB->Data;
}
}
sub closeDB {
$custBranchDB->Close();
}
=============================
------------------------------
Date: 10 Jun 1999 17:40:46 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Acess databse access from unix with perl?
Message-Id: <375ff89e.0@news.new-era.net>
(BXTC) (bxtc@forfree.at) wrote:
> Is there any EASY
> way I can use the Access DB in unix and for a web site?
Absolutely not. I just posted a long article on why not, very
recently. News archives ought to have it. Search deja news.
Basically, Access is NOT up to being a web backend database.
Scott
------------------------------
Date: Thu, 10 Jun 1999 17:00:29 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: Binary File Uploading - Part 2
Message-Id: <FD4F8t.Duy@csc.liv.ac.uk>
In article <01beb326$79e91480$fe31a2d1@ryano-ke>,
"Ryan" <dfs@thegrid.net> writes:
>
> sub print_results{
> open (NEWPIC,">../submits/$newname") || #open existing or create the
For starters Ryan never die in a CGI script, doesn't help at all (some of
the Gurus can probably get away with it but I as one of the lesser mortals
here don't know how to do it).
Do something like this.
return $self->_error("Unable to create or open file $!");
were the _error call returns undef and you step out of the subroutines one
by one. Also in the _error subroutine you can then get it to print some
lovely structured HTML that tells you whats going on.
this will also have the added advantage of not dieing before that 500
error occurs which in my experience generally means the prog stops running
before a header is received, or that output was encountered before a
header occured.
However the FatalsToBrowser should take care of that I think and why Eric
has a valid point in suspecting it's a compile error.
--
Ian J. Garlick
ijg@csc.liv.ac.uk
Don't look back, the lemmings are gaining on you.
------------------------------
Date: 10 Jun 1999 11:26:15 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Binary File Uploading - Part 2
Message-Id: <xkfd7z4klvs.fsf@valdemar.col.hp.com>
"Ryan" <dfs@thegrid.net> writes:
> #!/usr/local/bin/perl
No -w. No "use strict;". Fix those, and most of your other errors
should be simple to find.
> use CGI qw/:standard/;
This is good.
> use CGI::Carp qw(fatalsToBrowser); #Sends full errors to
> browser
Is this what your code really looks like? Because I found a bunch of
lines like this, where a comment is continued on a new line without a
comment marker of its own. If not, you need to watch out and make sure
youre newsreader doesn't wrap lines of code indiscriminately.
<snip>
> &get_info; #sub routine call gets information from the form object
There's no reason you have to do it this way, unless you like that syntax
of function calls. "get_info();" would work just as well.
> sub get_info{
> $name = $query->param('name'); #name entered on form
You're using a global CGI object here. Why not pass it in (or pass in a
reference to it), and use that? It makes it much clearer which functions
use which program variables. 'perldoc perlsub' for more details.
> sub error{
Same here-- why not pass in the variables you're going to use, instead of
using globals everywhere? It's much better style.
> All of the above works just fine.
Are you sure? What happens when you run 'perl -c' on it?
> sub print_results{
> open (NEWPIC,">../submits/$newname") || #open existing or create the
> file and filehandle NEWPIC
> die "Unable to create or open file $!"; #or die program and send
> error to browser
Again, I can't tell if it's your newsreader or your code, but this
doesn't compile on my system-- I have to join the multi-line comments
together on one line.
> while ($bytesread=read($newname,$buffer,1024)) {
perldoc -f read
Note that read takes as its first argument a filehandle. Last I checked,
$newname is defined as follows:
> $file_name = $query->param('file_entered'); #file name entered
> @parts = split(/\\/, $file_name); #split file name path up
> $newname = $parts[$#parts]; #gets the last part of parts array
Which is to say, $newname is a string, not a filehandle.
> print NEWPIC $buffer;
> }
> close(NEWPIC); #close NEWPIC
> }
>
> Any thoughts anyone?
Yes-- write all your perl programs with -w and 'use strict;' until you
know when not to.
-=Eric
------------------------------
Date: Thu, 10 Jun 1999 08:53:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: block inside print ?
Message-Id: <MPG.11c97f3cee2fb14d989bad@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <375fc14e.0@usenet.fccj.cc.fl.us> on Thu, 10 Jun 1999
09:46:08 -0400, Bill Jones <bill@fccj.org> says...
> In article <375fa440.0@usenet.fccj.cc.fl.us>, "Bill Jones" <bill@fccj.org>
> wrote:
...
> $vFlag = "0|0|0|0|0|0|x|x|x";
>
> print
> " Well? ",
> {
> ((split(/\|/, $vFlag))[7] eq 'x') ? 'do this' : 'do that'
> },
> "\n";
<SNIP> of hundred-line ramble through irrelevancies.
Why not just leave out the squiggly brackets? D'oh!
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 10 Jun 1999 12:15:51 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: block inside print ?
Message-Id: <375fe45c.0@usenet.fccj.cc.fl.us>
In article <MPG.11c97f3cee2fb14d989bad@nntp.hpl.hp.com>, lr@hpl.hp.com
(Larry Rosler) wrote:
> Why not just leave out the squiggly brackets? D'oh!
I seen that way after the other ramblings.
Sorry,
-Sneex- :(
_________________________________________________________________________
$_ = "Jacksonville Perl Monger"; while(/([Jacksonville Perl Monger])/g){
print join(" ", map { defined $_ ? $_ : "" } $`, $&, $', $+), "\n"; }
------------------------------
Date: Thu, 10 Jun 1999 10:16:08 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Christian Hummert <Hummert@infantry.usmc.net>
Subject: Re: Bulletin Board in Perl
Message-Id: <375FF2D8.7E5744E4@mail.cor.epa.gov>
[courtesy cc sent to poster]
Christian Hummert wrote:
>
> Thank you for you nice Tips ;-) But I aktually dont know what you expect
> me to do... The Perl source I wrote are 300 lines, and I think it is a
> bad Idea to send the whole source to the newsgroup... But I will send
> you copy via Email if you wish one...
No, what the posters in this ng are asking you to do [even if
some of them are asking it in an abstruse way] is to try cutting
down your code to the smallest piece which still reproduces that
error. Often, just going through this sort of exercise will
show you where that error has to be. And sometimes it will
show you that the error is coming from *outside* of your Perl
program. This does take effort on your part, of course. But
all programming does.
> And there are no errors in the source, I can compile it with just 5
> warnings... But If I start the CGI Script the Server goes down... So I
> just asked if anyone had developed a BBS in the past so I could compare
> the sources...
Do you mean that:
[1] when you run this at the command prompt you get 5 warnings?
and
[2] it runs at the command prompt but bombs when run as a CGI?
#1 means that there are still some things you ought to clean
up. They may be intentional on your part, but they *may* be
real glitches which you have not noticed. They may be
really *serious* glitches.
#2 usually means that either your server is improperly con-
figured, or you're accidentally munging the html headers in
your Perl code or in the rest of your CGI script. Or both.
In this case, your best bet is to follow the directions in
the FAQs and guides listed in the answer to question 1 of
perlfaq9.
> Thank you
> Christian Hummert
You're welcome
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 10 Jun 1999 11:33:50 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: can i variably name an array?
Message-Id: <xkfaeu8klj5.fsf@valdemar.col.hp.com>
bart.lateur@skynet.be (Bart Lateur) writes:
> Tom Christiansen wrote:
> >Script kiddies don't have real programming backgrounds.
>
> So programming in Perl isn't "real" programming?
script kiddies != Perl programmers
script kiddies are those who take ready-made programs that break things--
usually DOS attacks on an ISP or company-- but have no actual
comprehension of what makes them work. Some few of them (the few that
generate said scripts or programs) might, but it's generally a very
ad-hoc understanding, with little (if any) formalism, and often lots of
useless cruft.
Perl programmers, OTOH, are models of virtue, citizenship, and
intelligence. We brush our teeth at least twice a day, shower a minimum
of once a week (whether we need it or not), have good social skills, and
enjoy a rousing game of darts of a weekend.
Okay, I made up the part about the darts. But you get my point, I
hope. :)
-=Eric
------------------------------
Date: Thu, 10 Jun 1999 16:10:02 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Checking symlinks in Perl
Message-Id: <7jonvq$kjp$1@monet.op.net>
In article <7jmkn3$eba$1@fcnews.fc.hp.com>, Andrew Allen <ada@fc.hp.com> wrote:
> unlink foreach grep {-l && !-e} readdir MYDIR;
Unlink can take a list:
unlink grep {-l && !-e} readdir MYDIR;
------------------------------
Date: Thu, 10 Jun 1999 10:35:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Compile and IIS
Message-Id: <Pine.GSO.4.02A.9906101035160.26349-100000@user2.teleport.com>
On Thu, 10 Jun 1999, Arthur Yeung wrote:
> 1. Is it possible to compiles *.pl to exe file?
See the FAQ.
> 2. How can I let my MS IIS 3.0 to run perl scripts? Please give me
> some steps.
Step one: Check the docs, FAQs, and newsgroups about your server.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 10 Jun 1999 09:24:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Definition of words in Perl and POSIX
Message-Id: <MPG.11c9868bf1a92165989bb1@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7johri$m7o$1@knot.queensu.ca> on Thu, 10 Jun 1999 10:24:02 -
0400, Mark Goodaire <6jmg@post.queensu.ca> says...
> The script that I'm writing requires me to match against patterns that are
> ALMOST the same as the default word in PERL, \w, equivalent to the character
> set [A-Za-z0-9_]. What I need is a slightly modified definition of \w, so
> that \w will match characters in the set [A-Za-z0-9_-] for instance. Does
> anyone know how I can do this? From the reading I've done I get the
> impression that I need to use locales and possible some part of POSIX, but
> the PERL documenation hasn't been much help.
Why do you think you need to modify the definition of '\w'? Wherever
you would have used '\w', use [\w-]'. Voila.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 10 Jun 1999 10:03:00 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: duplicate rows
Message-Id: <Pine.GSO.4.02A.9906100959210.26349-100000@user2.teleport.com>
On Wed, 9 Jun 1999, Raj wrote:
> how do i eliminate duplcate rows in a textfield which has say..only
> one column
You probably want to use a hash. Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 10 Jun 1999 10:06:11 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Raj <technology@workmail.com>
Subject: Re: duplicate rows
Message-Id: <375FF083.49D408ED@mail.cor.epa.gov>
[courtesy cc sent to poster]
Raj wrote:
>
> how do i eliminate duplcate rows in a textfield which has say..only one
> column
It sounds to me like you need to read in perlfaq4. Check out the
answer to this question:
"How can I extract just the unique elements of an array?"
In general, you should check in the FAQ before posting. It's
much much faster for you, and you don't end up with a bunch
of Perlites telling you to go read the FAQ. :-)
> ASAP....please ! TIA
See? When you need it in a hurry, use your own documentation
on your own system. It's always faster, and you learn more
that way too.. so the *next* problem gets solved sooner as
well.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 10 Jun 1999 19:26:29 +0200
From: Henk Bokhoven <h.c.a.bokhoven@bok.selwerd.cx>
Subject: Re: Error while running News-Scan-0.51
Message-Id: <375FF545.BDB55F85@bok.selwerd.cx>
Jonathan Stowe wrote:
>
> Henk Bokhoven <h.c.a.bokhoven@kpn.com> wrote:
> > Hi there!
> >
> > [ see subject ]
> >
> > This is what I get:
> >
> > -- 8< -- cut here -- 8< --
> > Encountered CODE ref, using dummy placeholder \
> > at /usr/lib/perl5/5.00502/i586-linux/Data/Dumper.pm line 429.
> > Argument "1, 2, and 4" isn't numeric in eq at ./news-stats line 229.
> >
>
> It might be useful if you posted the section of your code that is
> giving rise to this problem.
Hope this'll do... Cheers,
[*] Dumper.pm
-- 8< -- cut here -- 8< --
#
# same, only calls the XS version
#
sub DumperX {
return Data::Dumper->Dumpxs([@_], []); <-- line 429
}
sub Dumpf { return Data::Dumper->Dump(@_) }
sub Dumpp { print Data::Dumper->Dump(@_) }
-- 8< -- cut here -- 8< --
[*] news-stats
-- 8< -- cut here -- 8< --
print <<EOAvgs; <-- line 229
Averages
========
Posts per poster: $posts_avg
median: $pmed post@{[$pmed == 1 ? "" : "s"]}
mode: $pmode post@{[$pmode == 1 ? "" : "s"]} - $pmode_score
poster@{[$pmode
_score == 1 ? "" : "s"]}
s: $psd post@{[$psd == 1 ? "" : "s"]}
Posts per thread: $thr_avg
median: $tmed post@{[$tmed == 1 ? "" : "s"]}
mode: $tmode post@{[$tmode == 1 ? "" : "s"]} - $tmode_score
thread@{[$tmode
_score == 1 ? "" : "s"]}
s: $tsd post@{[$tsd == 1 ? "" : "s"]}
Message size: $msg bytes
- header: $hdr bytes ($hdr_lines lines)
- body: $body bytes ($body_lines lines)
- original: $orig bytes ($orig_lines lines)
- signature: $sig bytes ($sig_lines lines)
EOAvgs
-- 8< -- cut here -- 8< --
--
___ ___ __ | Henk C.A. Bokhoven, Groningen, NL
/ / / /____ (__)__ ___ | E-mail : hbokh at worldonline dot nl
/ /_/ / _ \/ /\ \/ / | day : HP-UX, Digital OSF1, Linux
\___,__/__//__/__/ /__/\__\ | night : Linux SuSE 6.1 on an i686
------------------------------
Date: 10 Jun 1999 17:05:14 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
To: u970130@studbo.hit.no (Thomas Weholt)
Subject: Re: Examples, sources and tutorials
Message-Id: <7jor8a$1n$1@brokaw.wa.com>
[Posted and mailed]
u970130@studbo.hit.no (Thomas Weholt) writes:
> Hi,
>
> Is there a site on the net with lots of simple scripts, examples of
> whole programs etc.?
>
http://www.stonehenge.com/
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Thu, 10 Jun 1999 12:11:58 -0400
From: Toby <"tapplega--just remove this--"@utk.edu>
Subject: Re: Executing adduser? Follow Up.
Message-Id: <375FE3CE.6565B367@utk.edu>
Isn't this chomp here to get rid of potential newlines? I always thought that was good cricket. :-)
Toby
Hasanuddin Tamir wrote:
> On Fri, 4 Jun 1999, Tom Phoenix wrote:
>
> rootbeer] Date: Fri, 4 Jun 1999 11:33:16 -0700
> rootbeer] From: Tom Phoenix <rootbeer@redcat.com>
> rootbeer] To: comp.lang.perl.misc@list.deja.com
> rootbeer] Subject: Re: Executing adduser? Follow Up.
> rootbeer] Reply-To: comp.lang.perl.misc@list.deja.com
> rootbeer] Organization: Society for the Elimination of Unwarranted Excess Superfluous Text in Internet Header Lines
> rootbeer]
> rootbeer] while (<FILE>) {
> rootbeer] chomp;
> rootbeer] s/#.*//; # Drop comments
> rootbeer] s/^\s+//; # Drop leading whitespace
> rootbeer] s/\s+$//; # and trailing
> rootbeer] next unless /\S/; # Skip blank lines
>
> Just a bit curious, would it make different if
> skipping before chomp()-ing? I mean, why we
> chomp() on blank lines? Or why we chomp() on
> lines we want to skip?
>
> -hasan-
> uhm, no more sig(h)
------------------------------
Date: 10 Jun 1999 15:52:22 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: filehandles in Win95
Message-Id: <375FDEA4.E45E6EF7@vpservices.com>
> Steven & Christine Borgfeld wrote:
>
> open (OUT,"output") || die;
> print OUT "table #",$i,"\n";
>
> I'm getting the message:
> Filehandle main::OUT opened only for input at circle.bat line 39.
By default "open" uses read mode instead of write mode. To open a file
for writing you must use the ">" character like so:
open(OUT,">output") || die $!;
--
Jeff
------------------------------
Date: Thu, 10 Jun 1999 14:27:02 -0300
From: "kayec" <delete.the.nospam.kayec@gov.ns.ca>
Subject: Re: fork for DNS lookup - help
Message-Id: <VyS73.1142$aP5.44888@sapphire.mtt.net>
>> When your script does the lookups it sometimes returns 3-4....10
different
>> names for one IP. Now i realize this isn't a problem as it does actually
>> happen, but is their an easy way to modify the script to only give me
one.
>> I don't care about the rest.
>>
>But which one ?
>
Which IP gives different names?
Here's a few, i have lots others:
193.4.138.1
209.176.19.50
207.14.58.254
207.109.33.231
205.205.229.1
If you mean which name would i want.... Guess i don't care. If i do an
NSLOOKUP (win nt)
it only retuns one, usually the first one your perl script finds.
Question about the layout of each record:
--------------
-------------- --??-- -?- -?-- ----------- DNS ---------
1.229.205.205.in-addr.arpa. 3600 IN PTR www.mail.lesoleil.com.
>You can change the line that says :
> $rr->print;
>To:
> $rr->print unless $rr->type eq "CNAME";
>
In the above examples i just gave you, they all show up as PTR, not CNAME.
------------------------------
Date: Thu, 10 Jun 1999 19:01:00 +0200
From: alainch <alain_chiorboli@email.sps.mot.com>
Subject: hash table question
Message-Id: <375FEF4C.3488F558@email.sps.mot.com>
Hi all,
I want to create a database using a hash of hash table. In order to add
an element I use the function
described below:
sub update_record {
# Get input data
local (*input_table) = pop(@_);
my ($DBM_name,$reference) = @_;
my(%MAIN_TABLE);
my($key);
# Open the DBM table
dbmopen(%MAIN_TABLE, $DBM_name, 0660);
$MAIN_TABLE{$reference}{"dummy"} = "dummy";
# Update the table entry referenced by $reference
foreach $key (keys %input_table)
{
$MAIN_TABLE{$reference}{$key} = $input_table{$key};
print "DEBUG : $reference $key : $input_table{$key} \n";
}
# Close the DBM table
dbmclose(%MAIN_TABLE);
}
and I call this function like this: update_record ("TEST_DBM",
0,\%input_table);
%input_table contains:
key Value
----------
pipo0 bimbo0
pipo1 bimbo1
pipo2 bimbo2
When I first initialize my database I get the following records in the
database :
key Value
----------
0 pipo1 -> bimbo1
pipo2 -> bimbo2
Can someone explain me why the first record is not present in the
database. Indeed I expect
to have the following result:
key Value
----------
0 pipo0 -> bimbo0
pipo1 -> bimbo1
pipo2 -> bimbo2
Thanks.
--
------------------------------
Date: Thu, 10 Jun 1999 09:58:39 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Help on a news updating script I wrote...
Message-Id: <Pine.GSO.4.02A.9906100955280.26349-100000@user2.teleport.com>
On Wed, 9 Jun 1999, Mace wrote:
> Then when I tried to use one of the buttons that used javascript it
> said "An error has occured in this page."
That's not a Perl error. Maybe you should check with the docs, FAQs, and
newsgroups about javascript or the program which generated that error
message. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 10 Jun 1999 09:12:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to sort an array of hashes by one of the hash fields????
Message-Id: <MPG.11c983dbb8921e0f989baf@nntp.hpl.hp.com>
In article <375FCD52.4CA32CB8@bigfoot.com> on Thu, 10 Jun 1999 16:36:02
+0200, Andrzej Filip <anfi@bigfoot.com> says...
> william wrote:
> > I have made an array of hashes, and would like to arrange the order of
> > the array by an element in the hash. The code below is my attempt,
> > alas it doesn't work. Hoping somebody would point out my error or point
> > me in the direction of
> > some relevant information.
>
> Use sort function:
>
> my @out = sort { $a{sort_key} cmp $b{sort_key} } @in
Sigh.
Zero for two, Andrej. That doesn't work. $a and $b are not hashes,
they are references to hashes. So you must use the correct syntax for
references, And you should test your code before posting it.
Sigh.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 10 Jun 1999 10:20:41 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Integer conversion problem
Message-Id: <MPG.11c993bc5767f841989bb5@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <375FDA84.44D01C7F@usgs.gov> on Thu, 10 Jun 1999 15:32:20
GMT, William H. Asquith <wasquith@usgs.gov> says...
> Please someone help with the following C<int()> problem! I absolutely
> know that there is a stupid reason for int(-1) in the first case
> returning 0 and int(-1) in the second returning -1 but I am totally
> stumped.
>
> #!/usr/bin/perl5 -w
> my ($min, $max) = (0.1, 78.4);
> print "Min and Max are $min and $max\n";
> my ($logmin, $logmax) = (log10($min), log10($max));
> print "Log10 values are $logmin and $logmax\n";
Replace the line above with this:
printf "Log10 values are %.20f and $logmax\n", $logmin;
and all should be clear.
Floating-point numbers are approximations to real numbers.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 10 Jun 1999 17:45:09 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Integer conversion problem
Message-Id: <7jotj5$oak$1@pegasus.csx.cam.ac.uk>
In article <375FDA84.44D01C7F@usgs.gov>,
William H. Asquith <wasquith@usgs.gov> wrote:
>Please someone help with the following C<int()> problem! I absolutely
>know that there is a stupid reason for int(-1) in the first case
>returning 0 and int(-1) in the second returning -1 but I am totally
>stumped.
perldoc -f int :
---------------------------------------
Returns the integer portion of EXPR. If EXPR is omitted, uses C<$_>.
You should not use this function for rounding: one because it truncates
towards C<0>, and two because machine representations of floating point
numbers can sometimes produce counterintuitive results. For example,
C<int(-6.725/0.025)> produces -268 rather than the correct -269; that's
because it's really more like -268.99999999999994315658 instead. Usually,
the C<sprintf()>, C<printf()>, or the C<POSIX::floor> and C<POSIX::ceil>
functions will serve you better than will int().
---------------------------------------
It's always a mistake to apply int() to a quantity which has been computed
inexactly using floating point arithmetic, when the mathematically exact
answer would have been an integer.
Mike Guy
------------------------------
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 5949
**************************************