[10760] in Perl-Users-Digest
Perl-Users Digest, Issue: 4361 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 4 18:07:24 1998
Date: Fri, 4 Dec 98 15:00:20 -0800
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, 4 Dec 1998 Volume: 8 Number: 4361
Today's topics:
Re: "insecure" variables? (123) <snowe@rain.org>
@INC... <cyberbob@infinet.com>
ActivePerl perlscript and IIS brian.parks@stn.siemens.com
Re: big problem with Perl's time() limitations (Abigail)
Re: big problem with Perl's time() limitations (Abigail)
Book Reviewers Needed briles@my-dejanews.com
Re: Bug in timelocal? (Rich)
Re: CGI and LWP::Simple (Greg Ward)
Re: clean up html tags (Greg Ward)
Re: Connection to Microsoft SQL Server (rise)
Convert $seconds to $hours:$min:$sec (Bryce Pursley)
Re: Convert $seconds to $hours:$min:$sec (John Stanley)
Re: Convert $seconds to $hours:$min:$sec (Mark-Jason Dominus)
CPAN and ftp << Newbie alert >> <jramberg@xsoft.xerox.com>
Re: Creating a key field for writing relational databas (Mark Thompson)
Re: Creating a key field for writing relational databas <tripp.lilley@perspex.com>
Re: Fastest way to search through an array? <r28629@email.sps.mot.com>
Re: Fastest way to search through an array? <r28629@email.sps.mot.com>
Re: Fastest way to search through an array? <uri@ibnets.com>
Merge Files <group95@allied.demon.co.uk>
Re: oraperl <kperrier@blkbox.com>
Re: Petition: The US Gov't Should Evaluate Open Source <barmar@bbnplanet.com>
Regular Expression Question aschneid@cmp.com
Re: Removing a line... (Andrew M. Langmead)
search: script for sending form by mail <nissen@dasinternetbuero.de>
Using glob() w/WinNT vs. glob() w/Win95 (Charles Wilt)
Re: When does CLOSE not FLUSH? <rra@stanford.edu>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 4 Dec 1998 12:53:44 -0800
From: Nick Halloway <snowe@rain.org>
Subject: Re: "insecure" variables? (123)
Message-Id: <Pine.SUN.4.05.9812041251080.289-100000@coyote.rain.org>
In article <fl_aggie-0412981435350001@aggie.coaps.fsu.edu>
fl_aggie@thepentagon.com writes:
>In article <Pine.SUN.4.05.9812040833560.9223-100000@coyote.rain.org>, Nick
>Halloway <snowe@rain.org> wrote:
>
>+ It bombs like this:
>
>+ procmail: Executing "modenv_test,/home/snowe/submission"
>+ Insecure $ENV{PATH} while running setgid at
>
>+ `env >>/home/members/w/wesson9/junk1`;
>
>Oh, you bet that's insecure. Obviously, tainting is turned on (as it
>should be with a set(g|u)id program), so you should turn the 'perldoc
>perlsec' to help with the untainting.
>
>Hint: which "env" are you getting?
>Hint: set $ENV{PATH} in the script
The environment variables are set in a shell script which calls the
perl script. Is that insecure in reality, rather than in the eyes
of perl? if not, can perl be called with tainting turned off?
Thanks.
------------------------------
Date: Fri, 04 Dec 1998 21:32:24 GMT
From: Brad Whitaker <cyberbob@infinet.com>
Subject: @INC...
Message-Id: <366854E5.1FF2AFB3@infinet.com>
I'm running Perl Win32 and I need to add /apache/cgi-bin to the @INC
directory. How do I do this permanently? Do I have to compile the
source with my dir added in???
--
BRaD WHiTaKeR
(CyBeRBoB@iNFiNeT.CoM)
(CyBeRBoB@MiNDLeSS.CoM)
(BRaDWHiT@GeoCiTieS.CoM)
(BRaDWHiT@eaRTHLiNG.NeT)
(http://www.infinet.com/~cyberbob)
------------------------------
Date: Fri, 04 Dec 1998 21:57:52 GMT
From: brian.parks@stn.siemens.com
Subject: ActivePerl perlscript and IIS
Message-Id: <749lsu$ult$1@nnrp1.dejanews.com>
I just installed ActivePerl (build 507) and want to write some ASP pages using
PerlScript rather than VBScript.
ActivePerl installed OK, and I can run standard perl cgi scripts, but I'm
having problems with the following perlscript (ASP):
<%@ LANGUAGE = PerlScript %>
<html>
<body>
<%
$Response->write("Hello World");
%>
</body>
</html>
My browser returns the following error message:
---------------------------------------------------------------------------
$Response->writeblock(0); $Response->write("Hello World"); error '80004005'
Can't call method "writeblock" on an undefined value.
?
----------------------------------------------------------------------------
Does anyone have any idea what could be causing this??
Thanks in advance,
Brian
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 4 Dec 1998 21:28:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: big problem with Perl's time() limitations
Message-Id: <749k59$aa9$1@client3.news.psi.net>
Andreas Schildbach (andreas.schildbach@rkdnet.de) wrote on MCMXXI
September MCMXCIII in <URL:news:366907c9.17179022@news.mediaways.net>:
++ Hello,
++
++ I've got a problem with Perl's time()-format limitations, mainly being
++ able to express only dates starting at 1.1.1970.
++
++ I want to store birthdates in that format, but due to the above
++ limitation this is not possible.
++
++ Can anyone point me to an alternative that meets the following
++ requirements:
++
++ 1) can express date AND time in one scalar (like time does).
my $year = 'whatever';
my $day_of_year = 'whatever';
my $seconds_after_midnight = 'can be float';
my $format = "$year\n$day_of_year\n$seconds_after_midnight";
++ 2) ranges from <1900 to >2050 (the more the better).
Limited by the amount of virtual memory of your machine.
++ 3) minimum resolution: seconds, but 1/10 or 1/100 of a second would be
++ better (for other purposes than the birthdates, of course... :-)
As precise as you want.
++ 4) a minimum set of utility functions with functionality equal or
++ greater than those included in the perl-package (timelocal,
++ localtime).
Of course, you could look into Date::Manip, which has tons of functions
to deal with arbitrary dates.
Abigail
------------------------------
Date: 4 Dec 1998 22:17:10 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: big problem with Perl's time() limitations
Message-Id: <749n16$aq5$1@client3.news.psi.net>
Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MCMXXI September
MCMXCIII in <URL:news:7498kj$23d$1@mathserv.mps.ohio-state.edu>:
++ [A complimentary Cc of this posting was sent to Sean McAfee
++ <mcafee@waits.facilities.med.umich.edu>],
++ who wrote in article <jpU92.115$4w2.416293@news.itd.umich.edu>:
++ > In article <366907c9.17179022@news.mediaways.net>,
++ > Andreas Schildbach <andreas.schildbach@rkdnet.de> wrote:
++ > >I've got a problem with Perl's time()-format limitations, mainly being
++ > >able to express only dates starting at 1.1.1970.
++ >
++ > This isn't true; although it doesn't meet all of the conditions you specify
++ > below, you can get dates before 1970 by using negative numbers. Try this:
++ >
++ > perl -le 'print scalar localtime(-2**30)'
++
++ Do not try to push your system idiosyncrasies to us all.
++
++ perl -le "print scalar localtime(-2**30)"
++ Thu Jan 28 11:51:12 2072
++
++ Btw, I think Solaris 7 allows you to have 64-bit time, so one may have
++ a sane time *today* on Unixish systems too, not only on mainframes.
I don't think so.
$ ./perl -le "print scalar localtime(-2**30)"
Mon Dec 23 05:22:56 1935
$ ./perl -le "print scalar localtime(2**33)"
Wed Dec 31 18:59:59 1969
$ ./perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=solaris, osvers=2.7, archname=sun4-solaris
uname='sunos alexandra 5.7 generic sun4u sparc '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='/opt/SUNWspro/bin/cc', optimize='-O', gccversion=
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='/opt/SUNWspro/bin/cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib'
Abigail
------------------------------
Date: Fri, 04 Dec 1998 21:14:37 GMT
From: briles@my-dejanews.com
Subject: Book Reviewers Needed
Message-Id: <749jbq$s6n$1@nnrp1.dejanews.com>
Manning Publications has a book proposal for a book on SysAdmins. If you are
a good understanding of this topic and are interested in reviewing a book
proposal for us please send an email message to briley@manning.com. Please
send you qualifications/experience as part of this message.
Thank You
--
Brian Riley
Publishing Assistant
Manning Publications Co.
Greenwich Ct.
(203)629-2211
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 4 Dec 1998 20:19:46 GMT
From: richm@ucesucks.mulveyr.roc.servtech.com (Rich)
Subject: Re: Bug in timelocal?
Message-Id: <slrn76ggqc.4u8.richm@ll.aa2ys.ampr.org>
On Fri, 04 Dec 1998 16:04:37 +0100, Your Real Name <seen@statoil.com> wrote:
( "problem" with localtime() deleted )
Ah, you might want to think about what happens during the switch
between standard time and daylight savings time... :-)
- Rich
--
Rich Mulvey
My return address is my last name,
followed by my first initial, @mulveyr.roc.servtech.com
http://mulveyr.roc.servtech.com
Amateur Radio: aa2ys@wb2wxq.#wny.ny.usa
------------------------------
Date: 4 Dec 1998 22:55:08 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: CGI and LWP::Simple
Message-Id: <749p8c$9p9$2@news0-alterdial.uu.net>
Douglas Clifton <doug@weboneinc.com> wrote:
> When I use both modules in a script:
>
> use CGI qw(:standard);
> use LWP::Simple qw(head);
>
> I get the following error/warning from Perl [v5.00404]:
>
> Prototype mismatch: sub main::head vs ($) at [snip]
>
> Which I assume means the method head() is defined in
> both CGI and LWP::Simple. Should I undef head before
> I `use' LWP::Simple?
That's probably more trouble than it's worth. (You'll have to wrap the
undef in a BEGIN, it'll get ugly, etc. etc.) I would just adjust the
import list for CGI to something that excludes 'head' (I'm assuming that
you're assumption that CGI provides a 'head' subroutine, and it's
included in the ':standard' export tag, is correct). To be extra safe,
you could also use an empty import list for LWP::Simple. Then, just
fully qualify 'head' when you need to use it: CGI::head or
LWP::Simple::head. A bit more typing, but you (or your successor) will
be thankful when you have to figure out the code six months or a year
down the road.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: 4 Dec 1998 22:51:37 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: clean up html tags
Message-Id: <749p1p$9p9$1@news0-alterdial.uu.net>
Xah <xah@best.com> wrote:
> I have about a hundred html files that I want to eliminate all the style tags
> such as <font>, bgcolor, etc. I can easily write a simple-minded script
> to do it but I want correctness. I can also try to download
> HTML::Parser and spend time to learn to use it, but it seems overkill.
No, HTML::Parser isn't overkill. It's not hard to learn, it's not hard
to use, and it will save you many wasted hours of fruitlessly attempting
to parse HTML with ever-hairer regexps.
When you want to parse HTML, use HTML::Parser. Simple.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: 4 Dec 1998 21:08:30 GMT
From: rise@ugcs.caltech.edu (rise)
Subject: Re: Connection to Microsoft SQL Server
Message-Id: <749j0e$gmh@gap.cco.caltech.edu>
Tripp Lilley <tripp.lilley@perspex.com> writes:
> Does anyone have pointers to docs on the TDS (Tabular Data Stream)
> format? (Yes, I realize this isn't explicitly a Perl question, but it
> would help me write a non ctlib-dependant driver for Sybase and/or
> MS-SQL). I've searched off and on over the past several months,
> sometimes spending an hour or two trying to follow links into numerous
> dead ends.
Have you looked at the FreeTDS homepage at Metalab (formerly Sunsite)?
http://metalab.unc.edu/freetds/index.html
Sounds like they're already working on something similar and I'm sure they
could use more volunteers.
Jonathan Conway
------------------------------
Date: Fri, 04 Dec 1998 20:12:04 GMT
From: hbpursle@duke-energy.com (Bryce Pursley)
Subject: Convert $seconds to $hours:$min:$sec
Message-Id: <366e3ed5.1299461667@news.infoave.net>
Is there a more elegant way to convert $seconds to $hours:$min:$sec?
To be honest, I'm not doing real well with my kludge.
$deltatime is the difference between the "occur" time and "clear" time
of an alarm in my alarm system in "seconds."
$deltasec = ($deltatime % 3600);
# this can still be over 59 so it's not finished yet
$deltamin = ($deltasec / 60);
# I can use printf to make this "look" right but I can't use it in
other operations real well. I want just the quotient and drop the
fraction.
$deltahour = ($deltamin / 60);
# Same as above.
This is where I'm heading but it looks like it's going to get real
ugly before I get what I'm looking for. Where should I head next?
Bryce
------------------------------
Date: 4 Dec 1998 20:39:35 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Convert $seconds to $hours:$min:$sec
Message-Id: <749ha7$g3p$1@news.NERO.NET>
In article <366e3ed5.1299461667@news.infoave.net>,
Bryce Pursley <hbpursle@duke-energy.com> wrote:
>$deltatime is the difference between the "occur" time and "clear" time
>of an alarm in my alarm system in "seconds."
>
>$deltasec = ($deltatime % 3600);
># this can still be over 59 so it's not finished yet
It can't be over 59 if you use the right number. How many seconds are
there in a minute? 60. Why did you use 3600?
$sec = $deltatime % 60;
>$deltamin = ($deltasec / 60);
># I can use printf to make this "look" right but I can't use it in
>other operations real well. I want just the quotient and drop the
>fraction.
So, like, you want the integer portion of the number? But why bother?
Why not just take the remainder? How do you convert seconds to minutes?
And then how many minutes are in an hour?
$min = ($deltatime/60) % 60;
>$deltahour = ($deltamin / 60);
># Same as above.
How many seconds in an hour?
$hour = $deltatime / 3600;
------------------------------
Date: 4 Dec 1998 16:11:10 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Convert $seconds to $hours:$min:$sec
Message-Id: <749j5e$d9q$1@monet.op.net>
In article <366e3ed5.1299461667@news.infoave.net>,
Bryce Pursley <hbpursle@duke-energy.com> wrote:
>Is there a more elegant way to convert $seconds to $hours:$min:$sec?
>
>To be honest, I'm not doing real well with my kludge.
sprintf("%d:%02d:%02d",
int($sec/3600),
int($sec/60)%60,
$sec%60,
);
------------------------------
Date: Fri, 04 Dec 1998 13:43:55 -0800
From: Jim Ramberg <jramberg@xsoft.xerox.com>
Subject: CPAN and ftp << Newbie alert >>
Message-Id: <3668579B.E641E68C@xsoft.xerox.com>
Hi:
I am trying to get CPAN to work and for some reason it seems determined
to
use ftp over lynx when it tries to ftp files. Problem is; is that I am
behind a
fire wall where ftp invloves.
iftp -n
ftp> user annonymous@ftp.perl.org
<etc>
There must of been something that I looked over when I installed this
and I would really appreciate some one telling me who to either:
tell it not use ftp at all and always use lynx or have it work
with iftp.
thanks much. please reply via e-mail after editing out the [no spam]
from the address
--
Jim Ramberg XEROX
Senior QA Engineer
------------------------------
Date: Fri, 04 Dec 1998 21:43:25 GMT
From: mark-lists@webstylists.com (Mark Thompson)
Subject: Re: Creating a key field for writing relational databases
Message-Id: <36694edf.555402@news.supernews.com>
I'm sorry, I guess my question was a bit vague. I have the tables normalized
and everything. What I'm trying to find was a way to randomly generate the
key on the fly.
I'm thinking that date/time combined with process id might be the only way to
go on this one.
On Fri, 04 Dec 1998 11:39:22 -0500, Erik van Roode
<newsposter@cthulhu.demon.nl> wrote:
>Mark Thompson wrote:
>>
>> Hi,
>>
>> I'm rewriting a program that now writes to a simple text file so that it will
>> create 2 tables for importing into a database.
>>
>> Basically, the two files will be a customer file and a parts ordered file.
>> Obviously to link them I need a unique key field.
>>
>> Does anyone have any suggestions on how to generate a key field value on the
>> fly in Perl? I'm using 5.005 if that makes any difference. Anything pretty
>> much goes as long as it can guarantee that there are no duplicates. I've
>> seen stuff combining the process id and the date/time but I was wondering if
>> there were any better methods (plus, I don't know if this is foolproof.)
>
>This isn't really a perl-specific question, but a database question:
>
>Table 1 (customer)
> cust_id name address etc...
>
>Table 2 (order)
> id id2 cust_id
>
>The tables are linked through the cust_id field
>cust_id is your unique key for customer
>id|id2 is your unique key for order
>
>So for customer 25 you would number the orders as follows:
> id id2 product
> 25 1 shoes
> 25 2 jeans
>
>This doesn't answers your question the way you stated it, but I think this is
>what you need.
>
>Erik
------------------------------
Date: Fri, 04 Dec 1998 17:16:38 -0500
From: Tripp Lilley <tripp.lilley@perspex.com>
Subject: Re: Creating a key field for writing relational databases
Message-Id: <36685F46.A6119916@perspex.com>
Mark Thompson wrote:
> I'm sorry, I guess my question was a bit vague. I have the tables normalized
> and everything. What I'm trying to find was a way to randomly generate the
> key on the fly.
Your best bet is probably to find out if your database supports sequences or
unique id fields or the like. Well, I say "best" in the sense of "most efficient"
and "not dependent on your code being the only instance running".
If you're not familiar with the techniques above, in brief, many databases support
the automatic generation of unique values, or sequential values. Unfortunately,
the syntax for using these is not standardized as part of SQL, so if you're
concerned about portability among DBs, you might want to work it from another
angle. These are a bonus, though, for a lot of reasons. They're fairly fast (running
in the DB engine instead of forcing you to read and write values to the tables
to maintain your own counter fields). They are atomic (ie: if two processes ask
the DB for the next value in the sequence, they'll both get a unique value as they
expect, and the DB will take care of the locking to do so). In a lot of DBs, they
can be tied directly to the table, so that insertion implicitly creates an ID (MS
Access, though it has many warts, does handle this nicely).
If your DB doesn't support these, or you're terribly concerned about portability,
then you can write the sequence code "out of process". That is, use your DB for
persistent storage of the state of the counter, and write some Perl to actually do
the work of maintaining the state. This has a whole bunch of gotchas associated
with it.
If you go the other route, not using a "sequence" or "counter", but instead trying
to build a guaranteed unique ID, then you have another set of issues to wrestle.
If your app is standalone, and you're only worried about collisions between runs
of the app separated temporally on the same machine, then you can hack
together something easy, but I don't recommend it. Remember that everything
will eventually be made to scale, regardless of whether or not it was designed
to do so :-) They accuse me of overengineering, I congratulate me for "thinking
ahead".
Anyway, if you expect that you will need to coordinate unique, ad-hoc generated
values among multiple instances of the software, and you don't have a synch
mechanism they can share easily (ie: the database), then consider looking into
the UUID or GUID (synonyms -- Universally Unique ID and Globally Unique ID).
They are documented in the Internet Draft <draft-leach-uuids-guids-01.txt>,
available from http://www.ietf.org/internet-drafts/draft-leach-uuids-guids-01.txt .
Fortunately, this draft includes both treatment of the algorithms /and/ working
code!
(in C, but, hey!).
------------------------------
Date: Fri, 04 Dec 1998 13:43:15 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Fastest way to search through an array?
Message-Id: <36683B53.326432CA@email.sps.mot.com>
[posted to c.l.p.m and copy emailed]
Eric Bohlman wrote:
[...]
> sub compare_pop_users {
> #create a hash whose keys are the elements of @master_list and whose values
> #are any defined value (1 for convenience)
> my %temp = map {$_,1} @master_list;
> #add as keys all elements of @pop_user. The hashing process will avoid
> #duplication
> @temp[@pop_user] = 1 x @pop_user;
^ ^ ^
perhaps this is what you meant:
@temp{@pop_user} = (1) x @pop_user;
or simply:
@temp{@pop_user} = ();
since the values are not important.
Actaully it could be done all in one line:
my %temp = map {$_, undef} @master_list, @pop_user;
> #turn the hash back into an array of elements
> @master_list = keys %temp;
> }
>
> This code does depend on one assumption: that the order of entries in
> @master_list is unimportant.
to preserve the order, you could do:
my %temp = map {$_, undef} @master_list;
foreach (@pop_user) {
push @master_list, $_ if exists $temp{$_};
}
-TK
------------------------------
Date: Fri, 04 Dec 1998 13:53:18 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Uri Guttman <uri@fastengines.com>
Subject: Re: Fastest way to search through an array?
Message-Id: <36683DAE.9670AE78@email.sps.mot.com>
[posted to c.l.p.m and copy emailed]
Uri Guttman wrote:
>
> >>>>> "EB" == Eric Bohlman <ebohlman@netcom.com> writes:
>
> EB> sub compare_pop_users {
> EB> my %temp = map {$_,1} @master_list;
>
> or an idiom i like better:
>
> @temp{ @master_list } = (1) x @master_list ;
And more effecient too:
#!/usr/local/bin/perl -w
use Benchmark;
@list = ('a'..'z');
timethese (10000, {
by_map => sub { %hash = map {$_, undef} @list },
by_idiom => sub { @hash{ @list } = () },
}
);
__END__
Benchmark: timing 10000 iterations of by_idiom, by_map...
by_idiom: 1 wallclock secs ( 0.76 usr + 0.00 sys = 0.76 CPU)
by_map: 9 wallclock secs ( 8.47 usr + 0.01 sys = 8.48 CPU)
-TK
------------------------------
Date: 04 Dec 1998 16:21:30 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: Fastest way to search through an array?
Message-Id: <394srb7gdh.fsf@ibnets.com>
>>>>> "TS" == Tk Soh <r28629@email.sps.mot.com> writes:
TS> Actaully it could be done all in one line:
TS> my %temp = map {$_, undef} @master_list, @pop_user;
or to go back to the hash slice idiom again:
@temp{@master_list, @pop_user} = ();
>> #turn the hash back into an array of elements @master_list = keys
>> %temp; }
>>
>> This code does depend on one assumption: that the order of entries
>> in @master_list is unimportant.
TS> my %temp = map {$_, undef} @master_list;
TS> foreach (@pop_user) {
TS> push @master_list, $_ if exists $temp{$_};
TS> }
this is just a grep so use it:
push @master_list, grep( exists $temp{$_}, @pop_user ) ;
you need the exists since we created the hash with values of undef
uri
--
Uri Guttman Hacking Perl for Ironbridge Networks
uri@sysarch.com uri@ibnets.com
------------------------------
Date: Fri, 4 Dec 1998 21:28:51 -0000
From: "Bruce Davidson" <group95@allied.demon.co.uk>
Subject: Merge Files
Message-Id: <912806758.4937.0.nnrp-03.9e982204@news.demon.co.uk>
Would appreciate help to merge contents of * several flat files (pipe delim)
into one flat file, leaving originals intact. Something that would work with
Active Perl on W95.
Thanks
------------------------------
Date: 04 Dec 1998 14:34:44 -0600
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: oraperl
Message-Id: <ysid85z4pej.fsf@blkbox.com>
webboss@freenet.co.uk writes:
> Anyone using Oraperl on Linux to talk to an oracle database on a remote box
> (AIX)??
>
If I am correct, you need the ProC libs for Linux to compile the DBD::Oracle
modules. You will need to get these from Oracle.
There is an outside shot that you might be able to use JDBC but I don't
know of anyone who has.
> We need some advice on how well it works, especially as a cgi driven web-dbms
> link... and any other info you think helps the learning curve!
I'm no help here.
Kent
------------------------------
Date: Fri, 04 Dec 1998 20:05:52 GMT
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: Petition: The US Gov't Should Evaluate Open Source software
Message-Id: <AgX92.46$9w2.4058@burlma1-snr1.gtei.net>
In article <749dom$5he@panix2.panix.com>, Clay Shirky <clays@panix.com> wrote:
>Please sign the petition:
>
>The Federal Government Should Evaluate Open Source Software Whenever
>It Purchases or Upgrades Computers.
Most government procurements are put out to bid. There's nothing stopping
a vendor from using Open Source software in their response to the RFP, and
it seems like it should be a way for them to offer the solution at a lower
price for the same functionality.
So it sounds like your issue is mainly relevant to procuring COTS
(Commercial, Off-the-Shelf) software. Like many organizations, the
government likes having a vendor they can beat on when there's a problem
with the software. And unlike many small customers, the federal government
has enough clout that their complaints get heard and often acted on; they
derive quite a bit of benefit from traditional software pricing schemes,
because they often buy expensive site licenses and responsive vendors can
expect large future purchases.
But even when purchasing COTS software, the government, like many large
businesses, usually goes through middlemen, e.g. software integrators,
rather than purchasing directly from the vendor or retailers. These
middlemen often provide the first-line support services. As in my first
paragraph, there's nothing stopping software integrators from selling
packages based on Open Source software, and I expect the government would
be happy to purchase from them.
Unfortunately, government officials suffer from the same "nobody ever got
fired for buying IBM/Microsoft" syndrome that afflicts the rest of the
world. All things being equal, they're likely to pick the well-known name
brand. Luckily, Linux is achieving that stature in certain circles.
--
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.
------------------------------
Date: Fri, 04 Dec 1998 21:34:26 GMT
From: aschneid@cmp.com
Subject: Regular Expression Question
Message-Id: <749kh2$t8c$1@nnrp1.dejanews.com>
I am trying to do the following using a regular expression... any idea
How do I extract the aa only?
aa/bb/cc/dd/ee
Please reply via email... thanks
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 4 Dec 1998 20:03:40 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Removing a line...
Message-Id: <F3GIE4.4s3@world.std.com>
"R. Alcazar" <alcazar@netcomp.net> writes:
> I'm trying to remove a line from a text delimited list... a user enters
>a string. Whatever line this string is located on needs to be deleted. The
>text file looks like this (assume an indefinite amount of lines):
A text file is not designed for aribtrary insertion or deletion of
bytes. If you want to delete a line, you need to copy the entire file
except for the line which you want to remove.
See the FAQ entry ""How do I change one line in a file/delete a line
in a file/insert a line in the middle of a file/append to the
beginning of a file?" <URL:http://www.perl.com/CPAN/doc/manual/
html/pod/perlfaq5.html#How_do_I_change_one_line_in_a_fi>
Also, from what you explained, your program might be a good candidate
for using DBM files. See the AnyDBM_File man page for details.
--
Andrew Langmead
------------------------------
Date: Fri, 4 Dec 1998 22:05:56 +0100
From: "Erk Nissen" <nissen@dasinternetbuero.de>
Subject: search: script for sending form by mail
Message-Id: <749j0h$h40$1@news-hh.lynet.de>
hi,
i`m looking for a really good perl script, which can send a form by mail. it
should give a answer to the user. i will pay for it. does anybody noes?
thanks to all.
Eric
------------------------------
Date: 4 Dec 1998 22:42:04 GMT
From: charles.0272@worldnet.no.spam.att.net (Charles Wilt)
Subject: Using glob() w/WinNT vs. glob() w/Win95
Message-Id: <MPG.10d232d5e007c07d989691@netnews.worldnet.att.net>
The following is a short code snippet:
#!perl -w
while (glob("*.tst")){
print "$_\n";
}
which on a WinNT box correctly prints a list of all files with a tst
extension. But on a Win95 box, I get a message saying
"Read on closed filehandle <_GEN_0> at mytest line 6."
I new to this and would appreciate some insight.
--
Charles Wilt
Miami Luken, Inc.
e-mail: charles.0272@worldnet.no.spam.att.net
--->remove the no.spam.
------------------------------
Date: 04 Dec 1998 13:11:05 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: When does CLOSE not FLUSH?
Message-Id: <yld85zpq8m.fsf@windlord.stanford.edu>
Bart Lateur <bart.lateur@skynet.be> writes:
> How CAN you be sure it will only need one write?
Use syswrite().
> Is there maybe some maximum number of bytes allowed? What is that
> maximum, or is it implementation dependent?
I'm pretty sure one call to write(2) is atomic with respect to other
writes to the same file and that this is handled in the file system I/O
code in the kernel. But I'd have to double-check to make sure. I do know
that it's guaranteed that the seek and write are atomic with respect to
each other if O_APPEND is set, and since it wouldn't make much sense to
ensure that and not ensure that the write is atomic....
--
#!/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: 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 4361
**************************************