[13471] in Perl-Users-Digest
Perl-Users Digest, Issue: 881 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 22 20:07:23 1999
Date: Wed, 22 Sep 1999 17:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938045109-v9-i881@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 22 Sep 1999 Volume: 9 Number: 881
Today's topics:
Re: (-d $filename) test (Vasile Calmatui)
Beyond wantarray: Determining if sub should return hash <scottle@mr.net>
Re: Beyond wantarray: Determining if sub should return <gdaniel@amazon.com>
Re: Beyond wantarray: Determining if sub should return (Sean McAfee)
Re: Beyond wantarray: Determining if sub should return <uri@sysarch.com>
Re: Case insensitive SQL query <emschwar@rmi.net>
Re: Case insensitive SQL query <uri@sysarch.com>
Re: Case insensitive SQL query (Martien Verbruggen)
Re: Compile problem (Martien Verbruggen)
finding number of items in an array <mikej@1185design.com>
Re: finding number of items in an array <uri@sysarch.com>
Re: formatting output using swrite() <rick.delaney@home.com>
Re: I could use perldoc perlipctut (Martien Verbruggen)
Re: month/day algorithm (Sean McAfee)
Re: month/day algorithm <rootbeer@redcat.com>
My glob failed <synced@austin.rr.com>
Re: newbie question...well kindof <juergenp@cc.gatech.edu>
Re: newbie question...well kindof (Martien Verbruggen)
Q on DB_File <tavi367@ibm.net>
Re: REQ: tell-a-friend script (Martien Verbruggen)
Re: sort depth <uri@sysarch.com>
Re: sorting like numbers an array of strings <duraipPLEEASE__REMOVE_THIIS@extendsys.com>
Re: sorting like numbers an array of strings (Kragen Sitaker)
Sybperl - where to find binary ck475@hotmail.com
Re: Sybperl - where to find binary <mpeppler@peppler.org>
Usenet threading code? <joe@vpop.net>
Re: Usenet threading code? (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 22 Sep 1999 23:27:54 GMT
From: vasile@club-internet.fr (Vasile Calmatui)
Subject: Re: (-d $filename) test
Message-Id: <37e961a3.12691270@news.club-internet.fr>
Hello all ;-)
Just hoping the following code will satisfy everyone...
good luck,
#passes through all files of a given directory and modifies them
sub modifyFilesRecursively($) {
my ($whereToSearch)=@_;
opendir DIR, $whereToSearch or die;
my @dirFiles=readdir DIR or die;
closedir DIR or die;
foreach my $e (@dirFiles) {
next if(($e eq '.') || ($e eq '..'));
#passing to 'long' names
$e=concatPath($whereToSearch, $e);
if(-d $e){
modifyFilesRecursively($e);
}#if
else {
#here your work on files
}#else
}#foreach
}#modifyFilesRecursively
#concatenes two pathes and be sure a '\' is added between
sub concatPath($@) {
my ($path, @files)=@_;
#if nothing more to add
my $file=shift @files or return $path;
chop($path) if($path=~/\\$/);
$path.= $file=~/^\\/ ? $file : "\\".$file;
return concatPath($path, @files);
}#concatPath
kragen@dnaco.net (Kragen Sitaker) wrote:
>In article <m1d7vayeat.fsf@halfdome.holdit.com>,
>Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>Very common problem. Please remember what the output of readdir looks
>>like. Basenames only. No leading path. You are testing
>>"$current_directory/$file_name", not "$dir_name/$file_name" as you
>>should be.
>
>That's what I thought at first, too. But he chdir'ed to $dir_name
>before he even did the readdir, let alone before he did the -d test.
>
>There's another thing: chdir($dir_name) followed by opendir(CURRENTDIR,
>$dir_name) will only work if his paths are absolute. Right?
>
>I'll bet the first-level path is absolute, but then when he recurses,
>opendir fails because it's getting a relative path.
>
>By the way, you should make sure you don't recurse on "." and "..". :)
--
Vasile Calmatui
vasile@club-internet.fr
http://www.chez.com/vasile/
------------------------------
Date: Wed, 22 Sep 1999 14:58:06 -0500
From: scottle <scottle@mr.net>
Subject: Beyond wantarray: Determining if sub should return hash or array
Message-Id: <37E934CE.5CAD0CD0@mr.net>
I am writing a subroutine that will unpack a record into its
individual elements. I want this subroutine to either return this data
as either an Array or as a Hash. I would like for the subroutine to be
able to do this automagically without my having to specifically tell
the subroutine what kind of list to return. Can I do this? If so, how?
I know that wantarray will tell me if the context is SCALAR, LIST, or
void, but I need more information that just LIST. I want to know if
the context was a Hash list or an Array list, if you get my meaning.
Examples:
%Record95 = GetFields($Record95); # returns a list of key/value pairs
@Record95 = GetFields($Record95); # returns a list of fields
In case you want to know why I want to this, I want to do this because
I am writing a program to manipulate an electronic health care claim
file (a UB92 file in this case). The individual fields of each record
of this file may be refered to by their name (Patient Control Number)
or by their position in the record (95-02).
I have considered writing two subs, GetFieldsArray and GetFieldsHash,
or writing one sub and passing in the type of data structure to
return, ie. GetFields($Record, [Array|Hash]). But if I can have the
subroutine automagically determine the type of data structure to
return, that would be great!
Scott McGerik.
------------------------------
Date: 22 Sep 1999 17:06:00 -0600
From: Daniel Grisinger <gdaniel@amazon.com>
Subject: Re: Beyond wantarray: Determining if sub should return hash or array
Message-Id: <m2btaupmw7.fsf@krakatua.mutagenic.org>
scottle <scottle@mr.net> writes:
> I am writing a subroutine that will unpack a record into its
> individual elements. I want this subroutine to either return this data
> as either an Array or as a Hash. I would like for the subroutine to be
> able to do this automagically without my having to specifically tell
> the subroutine what kind of list to return. Can I do this? If so, how?
Nope, this isn't possible. Perl will always flatten any aggregate into
a simple list of scalars on return from a sub.
daniel
--
Daniel Grisinger gdaniel@amazon.com
------------------------------
Date: Wed, 22 Sep 1999 22:51:50 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Beyond wantarray: Determining if sub should return hash or array
Message-Id: <a4dG3.748$V7.134279@news.itd.umich.edu>
In article <37E934CE.5CAD0CD0@mr.net>, scottle <scottle@mr.net> wrote:
>I am writing a subroutine that will unpack a record into its
>individual elements. I want this subroutine to either return this data
>as either an Array or as a Hash. I would like for the subroutine to be
>able to do this automagically without my having to specifically tell
>the subroutine what kind of list to return. Can I do this? If so, how?
To my knowledge, this is impossible.
>I know that wantarray will tell me if the context is SCALAR, LIST, or
>void, but I need more information that just LIST. I want to know if
>the context was a Hash list or an Array list, if you get my meaning.
Sorry, but "list context" is as specific as you can get.
>Examples:
>%Record95 = GetFields($Record95); # returns a list of key/value pairs
>@Record95 = GetFields($Record95); # returns a list of fields
Instead of having GetFields return its results this way, why not pass in
the destination as an argument? Then GetFields can determine whether it's
an array or hash, and populate it accordingly.
GetFields(\%Record95, $Record95);
GetFields(\@Record95, $Record95);
sub GetFields {
my ($dest, $rec) = @_;
if (ref($dest) eq "ARRAY") {
# fill up @$dest
} elsif (ref($dest) eq "HASH") {
# fill up %$dest
} else {
die "Argument 1 must be an array or hash reference!\n";
}
}
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: 22 Sep 1999 18:58:09 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Beyond wantarray: Determining if sub should return hash or array
Message-Id: <x7n1ue4kqm.fsf@home.sysarch.com>
>>>>> "s" == scottle <scottle@mr.net> writes:
s> I am writing a subroutine that will unpack a record into its
s> individual elements. I want this subroutine to either return this data
s> as either an Array or as a Hash. I would like for the subroutine to be
s> able to do this automagically without my having to specifically tell
s> the subroutine what kind of list to return. Can I do this? If so, how?
s> I know that wantarray will tell me if the context is SCALAR, LIST, or
s> void, but I need more information that just LIST. I want to know if
s> the context was a Hash list or an Array list, if you get my meaning.
s> Examples:
s> %Record95 = GetFields($Record95); # returns a list of key/value pairs
s> @Record95 = GetFields($Record95); # returns a list of fields
can't do it. there is only one list context and no hash contexts. a
better way might be to return a anon hash if it is a scalar context and
the list of fields in a list context.
s> In case you want to know why I want to this, I want to do this because
s> I am writing a program to manipulate an electronic health care claim
s> file (a UB92 file in this case). The individual fields of each record
s> of this file may be refered to by their name (Patient Control Number)
s> or by their position in the record (95-02).
what i have done is to have a hash which converts the field names to
column numbers. then i take the list of fields (names or numbers) and if
they are numbers keep them, and convert the names to numbers using the
hash. then an array slice will return all the requested fields. much
simpler than return contexts.
s> I have considered writing two subs, GetFieldsArray and GetFieldsHash,
s> or writing one sub and passing in the type of data structure to
s> return, ie. GetFields($Record, [Array|Hash]). But if I can have the
s> subroutine automagically determine the type of data structure to
s> return, that would be great!
or have it handle two different types of input and one type of output.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 22 Sep 1999 16:26:00 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Case insensitive SQL query
Message-Id: <xkfemfqk2h3.fsf@valdemar.col.hp.com>
mrbog@my-deja.com writes:
> Fuck the "accepted" charter. This is the INTERNET. We as a people
> decide our social standards, not some controlling higher body.
Wow. mrbog, meet killfile. Killfile, meet mrbog.
*plonk*
-=Eric
------------------------------
Date: 22 Sep 1999 18:43:41 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Case insensitive SQL query
Message-Id: <x7r9jq4leq.fsf@home.sysarch.com>
>>>>> "m" == mrbog <mrbog@my-deja.com> writes:
m> Fuck the "accepted" charter. This is the INTERNET. We as a people
m> decide our social standards, not some controlling higher body.
you are about to be my first actual plonked moron. if you fuck the
accepted charter here, then why have charters or newsgroups with titles
at all? and this group IS controlled by its members who have decided
through its charter to dicuss perl here and not SQL or any other off
topic stuff. so fuck off and die and stop posting here. you have just
guaranteed you will never get any help from any decent perl hacker
here. i for one will not.
m> And yes, by the way- if I had a "general algorythym" question I
m> definately might post it to a perl programming group (or a java
m> group or a c group or a lisp group) Know why? Because is
m> TANGENTIALLY RELATED.
you are tangentially related to pond scum. and to elephant shit. and to
mars rocks. and to pustules. should we keep talking about you and those
topics too? why not, there are no rules here, it is the internet.
mrbog is full of elephant shit and has a large pustule full of pond scum
and has mars rocks in his head. so how do you write a cgi in sql to
tell him that? here is the spurious perl content.
m> Sent via Deja.com http://www.deja.com/
m> Share what you know. Learn what you don't.
i think deja posters have to pass an iq test of walking under a low
bar. if they hit their head on the bar they can post. you have whacked
your skull too many times. like an old boxer, you have ceased to realized
what planet you are on because have been punched once too often. so go
retire from the ring and stop trying to be an asshole. you have
succeeded beyond your parent's wildest expectations.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Wed, 22 Sep 1999 23:07:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Case insensitive SQL query
Message-Id: <9jdG3.84$8B3.3325@nsw.nnrp.telstra.net>
In article <xkfemfqk2h3.fsf@valdemar.col.hp.com>,
Eric The Read <emschwar@rmi.net> writes:
> mrbog@my-deja.com writes:
>> Fuck the "accepted" charter. This is the INTERNET. We as a people
>> decide our social standards, not some controlling higher body.
>
> Wow. mrbog, meet killfile. Killfile, meet mrbog.
>
> *plonk*
Gosh.. You're patient.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Can't say that it is, 'cause it ain't.
NSW, Australia |
------------------------------
Date: Wed, 22 Sep 1999 22:57:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Compile problem
Message-Id: <89dG3.68$8B3.3325@nsw.nnrp.telstra.net>
In article <37E9452E.511FCF0D@sun.com>,
MORRISON DAVIS <MORRY.DAVIS@Sun.COM> writes:
[You only need to post messages once. They may not show up
immediately, but if your client says they've been posted, you can
normally trust it.]
> Below is the error message, any ideas how to fix this? Solaris 2.6 cc
> 4.2
Solaris 2.6 diesn't come with a decent cc. If you are talking about
/usr/ucb/cc, then you can safely forget it. That's a severely broken
compiler.
If you are talking about Sun's commercial cc, that one worked fine for
me. If you really mean that gcc has been installed, and has been made
to look like cc, that also worked fine for me. It can however be a bit
problematic to install it correctly.
You might need to give some more information about your compiler,
because the information you give us cannot be correct.
>
> `sh cflags libperl.a perlio.o` perlio.c
> CCCMD = cc -DPERL_CORE -c -O
> "perlio.c", line 508: identifier redeclared: vprintf
> current : function(pointer to char, pointer to char) returning
> int
> previous: function(pointer to const char, pointer to void)
> returning int : "/usr/include/stdio.h", line 262
> "perlio.c", line 515: identifier redeclared: vfprintf
> current : function(pointer to struct {int _cnt, pointer to uchar
> _ptr, pointer to uchar _base, uchar _flag, uchar _file}, pointer to c...
> previous: function(pointer to struct {int _cnt, pointer to uchar
> _ptr, pointer to uchar _base, uchar _flag, uchar _file}, pointer to c...
>: "/usr/include/stdio.h", line 261
> cc: acomp failed for perlio.c
> *** Error code 2
> make: Fatal error: Command failed for target `perlio.o'
Looks like vprintf has been declared twice. However, it says that your
stdio declares it as
function(pointer to const char, pointer to void) returning int
on line 262. My stdio (Solaris sparc 2.6) declares it as
extern int vprintf(const char *, __va_list);
And it also looks like your vfprintf is misdefined. Maybe __va_list is
not correctly defined in your header files.
Have you applied all Sun's recommended patches? Did you run sh
Configure correctly? Did you maybe tell it something that you
shouldn't have told it?
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: Wed, 22 Sep 1999 15:58:47 -0700
From: mikej <mikej@1185design.com>
Subject: finding number of items in an array
Message-Id: <37E95F26.E05B2164@1185design.com>
Hi All,
What would be the easisest way to find out how many items I have in an
array? I am reading in a text file and need to find out how many entries
(seperated by "|") are in the file at any given time. Here's my
subroutine where I need to incorporate it:
sub getimages {
open(IMAGEDATA, "<shared/data/directmail.dat");
@images = <IMAGEDATA>;
close IMAGEDATA;
foreach $line (@images) {
@myimage = split(/\|/,$line);
}
}
Thanks!
mike
------------------------------
Date: 22 Sep 1999 19:13:47 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: finding number of items in an array
Message-Id: <x7emfq4k0k.fsf@home.sysarch.com>
>>>>> "m" == mikej <mikej@1185design.com> writes:
m> What would be the easisest way to find out how many items I have in an
m> array? I am reading in a text file and need to find out how many entries
m> (seperated by "|") are in the file at any given time. Here's my
m> subroutine where I need to incorporate it:
this was just asked today. why do these types get this far without even
knowing something as basic as this? do you think perl would have no way
of telling you how big an array is? with all the perl code in the world,
wouldn't you expect that to be a basic feature? so why didn't you even
try to look it up in some docs. you must have read something to write a
loop like that. you even quoted the | in the regex. but of course you
could be a cargo cult programmer who doesn't even know what the code is
doing, only that it does something you need. i know this is a flame but
this is ridiculous so i just have to say:
RTFM!!!!!!!
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Wed, 22 Sep 1999 22:25:25 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: formatting output using swrite()
Message-Id: <37E9574E.A06ED07A@home.com>
[posted & mailed]
Farhad Farzaneh wrote:
>
> - there must be a good way of doing this with swrite().
...
> my $format = " ^<<< ^||| ^>>>\n";
> my $formatb = " ^<<< ^||| ^>>>~~\n";
$string = swrite($format, $a, $b, $c);
$string .= swrite($formatb, $a, $b, $c);
or in this case there is no need for the first format at all:
$string = swrite($formatb, $a, $b, $c);
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Wed, 22 Sep 1999 23:13:35 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: I could use perldoc perlipctut
Message-Id: <zodG3.95$8B3.3325@nsw.nnrp.telstra.net>
In article <slrn7uh293.db6.abigail@alexandra.delanet.com>,
abigail@delanet.com (Abigail) writes:
> Martien Verbruggen (mgjv@comdyn.com.au) wrote on MMCCXIII September
> MCMXCIII in <URL:news:beVF3.70$ml3.5445@nsw.nnrp.telstra.net>:
> `` In article <AMOE3.18513$N77.1387885@typ11.nn.bcandid.com>,
> `` kragen@dnaco.net (Kragen Sitaker) writes:
> ``
> `` whole chain of events. In parallell, one process may be blocked on one
> `` I/O, while another is happily reading from or writing to another I/O
> `` system.
>
> You are only blocked by I/O if you are using blocking I/O. If you don't
> want to be blocked by I/O, don't use blocking I/O.
ok, let's rephrase that. I/O waits.
Martien
--
Martien Verbruggen |
Interactive Media Division | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Wed, 22 Sep 1999 22:17:58 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: month/day algorithm
Message-Id: <qAcG3.745$V7.134091@news.itd.umich.edu>
In article <37E94FB9.DD55E132@ccrs.nrcanDOTgc.ca>,
Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca> wrote:
>Does anyone know of a way to compute the month / day from a value which
>gives the year and day number?
>eg. 1992 day 236
I find the Date::Calc module highly useful.
----------------------------------------------------------------------
use Date::Calc qw(Add_Delta_Days);
@date = Add_Delta_Days(1992, 1, 1, 235);
print "month/day is $date[1]/$date[2]\n";
----------------------------------------------------------------------
You can find Date::Calc on CPAN, the Comprehensive Perl Archive Network,
itself accessible from www.perl.com.
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Wed, 22 Sep 1999 16:31:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: month/day algorithm
Message-Id: <Pine.GSO.4.10.9909221630060.26916-100000@user2.teleport.com>
On Wed, 22 Sep 1999, Tom Kralidis wrote:
> Does anyone know of a way to compute the month / day from a value
> which gives the year and day number?
If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-) Hope this helps!
http://www.cpan.org/
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 22 Sep 1999 22:48:03 GMT
From: Kevin Colquitt <synced@austin.rr.com>
Subject: My glob failed
Message-Id: <Pine.LNX.4.10.9909221740270.28639-100000@kalimoth.death.org>
Can someone enlighten me on why this isn't working.
With the following code:
> @results = `/usr/bin/smbstatus`; # I'm grabbing the results for a samba
> # command and sticking it into an array
>
The value for @results[6] should be something like:
> export csmkdc webdev 13716 302-44446 (135.147.1.148) Tue Sep 21 18:52:34 1999
and I'm trying to parse out the fields with the following:
> ($dir, $userid, $groupid, $pid, $computer, $ipaddress, $day, $month, $date, $hour, $year) = <@results[6]>;
Which gives me the error "glob failed (child exited with status 1) at test.pl line "
Much help would be greatly appreciated.
Thanks,
Kevin
------------------------------
Date: Wed, 22 Sep 1999 18:40:57 -0400
From: Juergen Pabel <juergenp@cc.gatech.edu>
To: Kragen Sitaker <kragen@dnaco.net>
Subject: Re: newbie question...well kindof
Message-Id: <37E95AF9.2FCB377B@cc.gatech.edu>
> I usually find that roughly 95%-99% of cases where an inexperienced
> person thinks the compiler or interpreter is broken, it is in fact
> their code that is broken.
well, i am not inexperienced in programming (12 years) plus i am about
to get my bs in cs...but new to perl...anyways, here's the deal:
the problem with
$tmp = 'pop.somedomain';
NET::POP3->new($tmp);
versus
NET::POP3->new('pop.somedomain');
is definitly a linux perl bug
as for the array check to the hash keys: it's a inter OS problem (blame
it on mickeysoft): i was working on a windows machine but the file was
stored over a SMB (linux samba) connection on a linux box. b/c of this a
\n\r is appended while linux perl expected a \n (i didn't think of the
extra \r), when i ftp'd those files to the sunOS the server received
them as text files and got rid of the \r ...
jp
------------------------------
Date: Wed, 22 Sep 1999 23:12:07 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: newbie question...well kindof
Message-Id: <bndG3.92$8B3.3325@nsw.nnrp.telstra.net>
In article <ZW9G3.3612$QJ.212618@typ11.nn.bcandid.com>,
kragen@dnaco.net (Kragen Sitaker) writes:
> In article <37E91E49.C8D50133@mail.cor.epa.gov>,
> David Cassell <cassell@mail.cor.epa.gov> wrote:
>>That low, huh? Are the other 4.9% - 0.9% due to win32 flaws?
>
> Mostly they're due to broken compilers or interpreters. You'd be
> amazed how bad some of the compilers and interpreters in the PC world
> are. (Actually, maybe you wouldn't. Maybe you have as much experience
> fighting with them as I do.)
As long as PC world in this case includes Linux :)
The RedHat 6.0 release includes a broken Perl. It also includes some
broken standard libraries, so it's tough to build your own Perl.
Martien
--
Martien Verbruggen |
Interactive Media Division | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Wed, 22 Sep 1999 18:29:04 -0500
From: "tavi" <tavi367@ibm.net>
Subject: Q on DB_File
Message-Id: <37e96655@news1.prserv.net>
I have a small script that uses DB_File to maintain control over an array
and kep it to disk.
This works just fine on my NT machine, but when I try and use it on my UNIX
(SunOS 5.0.5) it doesn't quite work right.
The data is retrieved from the submitting web form.
DB_File creates the text file for the data.
The text file is empty.
The array the data should be stored in is empty.
The error and access logs tel me nothing.
Any ideas on what I should look for?
Thanks
Tavi
------------------------------
Date: Wed, 22 Sep 1999 23:04:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: REQ: tell-a-friend script
Message-Id: <9gdG3.79$8B3.3325@nsw.nnrp.telstra.net>
In article <1dyjg4h.14y2iyz11ujt2tN@roxboro0-0046.dyn.interpath.net>,
planb@newsreaders.com (J. Moreno) writes:
> David Cassell <cassell@mail.cor.epa.gov> wrote:
>
>> J. Moreno wrote:
>> [snip]
>> > Uhm, elsif may be correct perl, but it's still a typo.
>>
>> A typo of *what* ?
>>
>> I'm siding with Abigail on this. 'elsif' is a slug of
>> computer jargon, and is not an English word. It only
>> needs to remind people of a couple English words.
>
> But we don't speak just english -- we speak various computer
> jargons too; and elseif is the correct and natural spelling.
In English. It is definitely not the correct spelling in a few other
languages that I know of.
My point being that elsif is not English. It's Perl. And therefore it
does not have to obey English spelling rules. Perl often does, but
there is no requirement for it. It might as well have been foogleblurb
or fidgetygit. It's just easier to remember elsif. If the designers of
the language had good reasons to prefer elsif above elseif, then they
are right. If they had decided that gargleblaster was more valid, they
still would have been right. Maybe less so, but still :)
Martien
--
Martien Verbruggen |
Interactive Media Division | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd. | selective about its friends.
NSW, Australia |
------------------------------
Date: 22 Sep 1999 18:25:16 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: sort depth
Message-Id: <x7u2om4m9f.fsf@home.sysarch.com>
>>>>> "KS" == Kragen Sitaker <kragen@dnaco.net> writes:
KS> In article <x3y1zbq7sta.fsf@tigre.matrox.com>,
KS> Ala Qumsieh <aqumsieh@matrox.com> wrote:
>> Wise Guy <WiseGuy_73NOcdSPAM@go.com> writes:
>>> I tried this out ___ it gives me 13 digits after the
>>> decimal point in the format x.xxxxxxxxxxxxxe+n ... where
>>> e+n is 10 to the corresponding power. This is if u tell
>>> Perl to treat the lines as numbers. If however, u enclose
>>> these in quotes, u will get the desired output :-)
>>
>> You mean lexicographic sorting which would sort 2000 ahead of 300 ?
KS> Lexicographic sorting will, indeed, sort "2000" ahead of "300".
KS> However, it will sort " 300" ahead of "2000". This is why
KS> right-justifying numeric fields is a Good Thing.
better to zero pad on the left than to right justify. make more sense as
you could do numeric or string compares as desired. assuming blank sorts
below digits works but is not nice.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 22 Sep 1999 23:26:53 GMT
From: "pjd" <duraipPLEEASE__REMOVE_THIIS@extendsys.com>
Subject: Re: sorting like numbers an array of strings
Message-Id: <7sbojt$nuf$0@198.102.102.248>
The following seemed to do what Miguel wanted.
Looks easier too.
@my_array = ( "4 , -20 , file1" ,
"3 , -15 , file2" ,
"4 , -2 , file3" ,
"3 , -14 , file4" );
sub sort_me{
($a1, $a2, $a3) = split /\s*,\s*/, $a;
($b1, $b2, $b3) = split /\s*,\s*/, $b;
return $a1 <=> $b1 or $a2 <=> $b2;
}
@sorted = sort sort_me @my_array;
print join ("\n",@sorted),"\n";
pj
------------------------------
Date: Wed, 22 Sep 1999 23:55:19 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: sorting like numbers an array of strings
Message-Id: <H%dG3.4085$QJ.252254@typ11.nn.bcandid.com>
In article <7sbojt$nuf$0@198.102.102.248>,
pjd <duraipPLEEASE__REMOVE_THIIS@extendsys.com> wrote:
>The following seemed to do what Miguel wanted.
It looks to me like it will, too.
>Looks easier too.
It is easier. The article to which you were replying used something
called the Schwartzian Transform, which is harder to read, but usually
faster.
Uri and Larry Rosler have an even faster method.
It probably won't make any difference for sorting less than 100 or so items.
Somebody really should code this particular example up into a benchmark.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Wed Sep 22 1999
47 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 22 Sep 1999 22:17:27 GMT
From: ck475@hotmail.com
Subject: Sybperl - where to find binary
Message-Id: <7sbkhb$vt5$1@nnrp1.deja.com>
Working on a new IBM RS/6000/AIX 4.3.2 . I managed to pull down gcc
and perl5 distributions for AIX and successfully install them on my new
RS6000 box
I downloaded the sybperl distribution and the build was successful
I have some database maintenance scripts, that appear to be written in
Perl4.0/sybperl
The script starts
#!/usr/local/bin/sybperl
require <getopts.pl>;
require <sybdb.ph>;
Well, when I run it in the new m/c (Perl-5), there is
no /usr/local/bin/sybperl compiled binary. When I copied over a
compiled binary from the older machine (where it ran fine), it then
complained about not finding getopts.pl (different @INC in the old
m/c ??)
Any help appreciated
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 22 Sep 1999 16:19:03 -0700
From: Michael Peppler <mpeppler@peppler.org>
Subject: Re: Sybperl - where to find binary
Message-Id: <37E963E7.49D37874@peppler.org>
ck475@hotmail.com wrote:
>
> Working on a new IBM RS/6000/AIX 4.3.2 . I managed to pull down gcc
> and perl5 distributions for AIX and successfully install them on my new
> RS6000 box
>
> I downloaded the sybperl distribution and the build was successful
>
> I have some database maintenance scripts, that appear to be written in
> Perl4.0/sybperl
>
> The script starts
>
> #!/usr/local/bin/sybperl
>
> require <getopts.pl>;
> require <sybdb.ph>;
>
> Well, when I run it in the new m/c (Perl-5), there is
> no /usr/local/bin/sybperl compiled binary.
You don't need a sybperl binary with perl5. You can simply change sybperl to
perl, and you should be fine (although I'm not sure about the sybdb.ph file...)
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@peppler.org -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
------------------------------
Date: Wed, 22 Sep 1999 15:25:10 -0700
From: "Joseph McDonald" <joe@vpop.net>
Subject: Usenet threading code?
Message-Id: <ruilq6rslg79@news.supernews.com>
Are there any perl modules for calculating "conversation threads" in usenet
messages (by reference-ID and subject).
Thanks,
-joe
------------------------------
Date: Wed, 22 Sep 1999 22:49:20 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Usenet threading code?
Message-Id: <Q1dG3.52$8B3.3325@nsw.nnrp.telstra.net>
In article <ruilq6rslg79@news.supernews.com>,
"Joseph McDonald" <joe@vpop.net> writes:
> Are there any perl modules for calculating "conversation threads" in usenet
> messages (by reference-ID and subject).
CPAN has a few modules related to NNTP, Net::NNTP and the News::*
modules. The most likely one to have code like this would be
News::NNTPClient (although I don't believe there's threading code in
it. You might be able to use those modules to roll your own, maybe you
could have a look at the sources for trn or knews or something like
that. If you roll your own, it would be nice if you made it cooperate
with these modules, and released it to CPAN :)
You could also mail the authors of those modules to see if anyone is
already working on something like that, or see if the distributions
contain todo lists.
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 881
*************************************