[17631] in Perl-Users-Digest
Perl-Users Digest, Issue: 5051 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 7 00:05:52 2000
Date: Wed, 6 Dec 2000 21:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976165509-v9-i5051@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 6 Dec 2000 Volume: 9 Number: 5051
Today's topics:
Re: Adding a Bcc recipient? <mikecook@cigarpool.com>
Re: Adding a Bcc recipient? <tony_curtis32@yahoo.com>
Re: Adding a Bcc recipient? (Ameen Dausha)
Re: Adding a Bcc recipient? <mikecook@cigarpool.com>
Attention NYC Shoppers & Visitors - Beware of Rip-off S Veteran_NYC_Shopper@nbgn.mil
Re: DBI insert problem <john@imining.com.tw>
Re: Doing a POST from a perl script? (Tad McClellan)
Re: FAQ 4.49: How do I permute N elements of a list? <johnlin@chttl.com.tw>
Re: Getting file properties <peter.sundstrom@eds.com>
Re: HASH OF LISTS - Question (Tad McClellan)
Re: HELP: regexing html <taboo@comcen.com.au>
Re: HELP: regexing html (Tad McClellan)
Re: How can I access seconds since the epoch? <dontspamme@awdang.com>
Re: How to write a packet sniffer for win32 (TCP Packet <carvdawg@patriot.net>
Re: mail ??? (David Efflandt)
MD5 module problems with Activestate Perl <peter.sundstrom@eds.com>
Re: Perl SQL Array <dontspamme@awdang.com>
Re: Please help with regular expressions (Tad McClellan)
Re: Reading Data from STDIN <dontspamme@awdang.com>
Re: rounding to nearest thousand (Craig Berry)
Sorting data in a flat file <eaks@worldnet.att.net>
Re: Sorting data in a flat file (Tad McClellan)
Re: Sorting data in a flat file <kstep@pepsdesign.com>
Re: Sorting data in a flat file <eaks@worldnet.att.net>
Re: Sorting data in a flat file <eaks@worldnet.att.net>
Re: Use PERL or Java? Which is faster? (Peter Schuller)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 6 Dec 2000 21:01:40 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: Adding a Bcc recipient?
Message-Id: <T_DX5.2665$T_3.505534@news.uswest.net>
# Send a mail to admin/bcc all users
open (MAIL, "|/usr/sbin/sendmail -t") or die "Unable to open
/usr/sbin/sendmail: $!";
print MAIL "To\:$address\n";
print MAIL "Bcc\:$recipients\n";
print MAIL "From\:$address\n";
print MAIL "Subject\:$regdata{'Subject'}\n";
print MAIL <<EOM;
$regdata{'Body'}
EOM
This works for me...
Michael
P.s. Tony:
if ( Perl=~/mail/ )
{
$answer_question="yes";
}
--
== CigarPool ==
http://www.cigarpool.com
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87r93me4ae.fsf@limey.hpcc.uh.edu...
> >> On Wed, 06 Dec 2000 01:04:27 GMT,
> >> "hokiebear" <ayambema@adelphia.net> said:
>
> > What syntax does one use to add a blind copy (Bcc)
> > recipient?
>
> perl != mail
>
> If this actually does have something to do with perl,
> please show some context/code...
>
> hth
> t
> --
> Eih bennek, eih blavek.
------------------------------
Date: 06 Dec 2000 22:37:24 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Adding a Bcc recipient?
Message-Id: <87bsuoq22j.fsf@limey.hpcc.uh.edu>
>> On Wed, 6 Dec 2000 21:01:40 -0700,
>> "Michael Cook" <mikecook@cigarpool.com> said:
># Send a mail to admin/bcc all users
>open (MAIL, "|/usr/sbin/sendmail -t") or die "Unable to open
>/usr/sbin/sendmail: $!";
The OP never mentioned sendmail. You don't know that
sendmail is involved at all.
>print MAIL "To\:$address\n";
Why is the ":" backslashed? A space after the ":" would
be nice too.
>print MAIL "Subject\:$regdata{'Subject'}\n";
>print MAIL <<EOM;
>$regdata{'Body'}
>EOM
You have not terminated the headers with a blank line.
You have also not closed the pipe and checked the status.
Passing -oi to sendmail would be a good idea as you don't
know if the data in the body contains a line with just
".".
> P.s. Tony: if ( Perl=~/mail/ ) { $answer_question="yes";}
The answer is exactly the same in any programming language
because this is a mail header construction question. Perl
has nothing to do with it.
And besides, didn't you see this plea to the OP? :-)
Tony>> If this actually does have something to do with perl,
Tony>> please show some context/code...
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Thu, 07 Dec 2000 04:43:04 GMT
From: ameen @ dausha . net (Ameen Dausha)
Subject: Re: Adding a Bcc recipient?
Message-Id: <3a2f14f5.85933563@news>
"Michael Cook" <mikecook@cigarpool.com> spake from on high claiming:
[snip]
>P.s. Tony:
>if ( Perl=~/mail/ )
>{
> $answer_question="yes";
>}
Better?
$answer_question = "yes" if ($Perl =~ /mail/i };
Ben Wilson (a.k.a. Ameen, Last of the Dausha)
____________________________
-"Ever heard of Aristotle . . . Plato . . . Socrates?!"
-"Yes."
-"Morons!"
------------------------------
Date: Wed, 6 Dec 2000 21:56:08 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: Adding a Bcc recipient?
Message-Id: <tNEX5.3405$T_3.544248@news.uswest.net>
comments interspersed...sorry if this post annoyed you,
Michael
--
== CigarPool ==
http://www.cigarpool.com
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87bsuoq22j.fsf@limey.hpcc.uh.edu...
> >> On Wed, 6 Dec 2000 21:01:40 -0700,
> >> "Michael Cook" <mikecook@cigarpool.com> said:
>
> ># Send a mail to admin/bcc all users
> >open (MAIL, "|/usr/sbin/sendmail -t") or die "Unable to open
> >/usr/sbin/sendmail: $!";
>
> The OP never mentioned sendmail. You don't know that
> sendmail is involved at all.
» he never mentioned which mail proggie at all, this is one I use which was
handy & shows the basics of bcc
>
> >print MAIL "To\:$address\n";
>
> Why is the ":" backslashed? A space after the ":" would
> be nice too.
» doesn't hurt, helps me readability - no space necessary - $address is
formatted
>
> >print MAIL "Subject\:$regdata{'Subject'}\n";
> >print MAIL <<EOM;
> >$regdata{'Body'}
> >EOM
>
> You have not terminated the headers with a blank line.
> You have also not closed the pipe and checked the status.
> Passing -oi to sendmail would be a good idea as you don't
> know if the data in the body contains a line with just
> ".".
>
» again my vars are preformatted and checked for illegal chars & this is
obviously just a snippet - I am a stickler for closing & checking, not to
worry...
> > P.s. Tony: if ( Perl=~/mail/ ) { $answer_question="yes";}
>
> The answer is exactly the same in any programming language
> because this is a mail header construction question. Perl
> has nothing to do with it.
>
» maybe he was asking for the Perl syntax & not the header info (which I
gave)? I am 99% sure my post was more helpful to him than yours and that it
took very little time longer to post. If you don't want to help, why be
mean - just ignore the post.
> And besides, didn't you see this plea to the OP? :-)
>
> Tony>> If this actually does have something to do with perl,
> Tony>> please show some context/code...
>
» nope - I was just skimming & trying to give some back to the community
which has helped me on numerous occasions...and I did show some
context/code.
> hth
> t
> --
> Eih bennek, eih blavek.
------------------------------
Date: 6 Dec 2000 23:37:07 GMT
From: Veteran_NYC_Shopper@nbgn.mil
Subject: Attention NYC Shoppers & Visitors - Beware of Rip-off SY Stores!!! ...... LQcYuL3hp
Message-Id: <6242CBDF.lmpqeeehwlc@wstratfod.gov>
SY stores have been around for about 50 years or so and have only one
objective - TO RIP YOU OFF!
-
They are a constant source of frustration for the NYC Department of
Consumer Affairs, which has been trying to close them down for as long as
I can remember. SY's are the most ruthless merchants in New York. I should
know, I once worked as a stock clerk for one of them.
-
The term "SY" refers to the ethnicity of the shopkeepers. They come from a
small and isolated region of Syria, where for centuries a cult of swindlers
has flourished. Approximately 60 years ago, they started to emigrate to the
U.S. and setup shop along Broadway at Times Square and later moved to some of
the less desirable locations along 5th Avenue.
-
Not surprisingly, SY stores are usually found in areas frequented by tourists.
-
You can always spot an SY store by the odd assortment of merchandise.
Radios, cameras and other assorted electronics on one side of the shop and
on the other; jade, ivory carvings, tablecloths, porcelain figurines,
oriental carpets, etc.
-
SY stores are singular in their objective... To extract as much money from
the customer as possible, *buy virtually any means at all*. There is no set
price in an SY store. The salesman keeps 1/3 to 1/2 of the profit on everything
he sells (which is a strong incentive to overcharge) and overcharge he will!
It is not unusual for these merchants to charge upwards of 500 - 1000% profit
on an item, while leading you to believe that you're actually getting a bargain
(which is the cornerstone of their craft).
-
These merchants are masters of deception and one should not try to match wits
with them. This is their lifelong profession... they've been doing it for
generations and most Americans are simply out of their league when it come to
trickery, deceit and high-pressure sales tactics.
-
A couple of things that might clue you in to the fact that you may stumbled into
an SY store:
-
If the staff speaks to one another in code words or in a language that you
don't recognize... if the words "Lot" or "C-Line" are used frequently in
reference to a specific item... if the price tag is marked with a price that
is demonstrably higher then it's being offered to you for, then chances are
your in an SY store.
-
JUST LEAVE! It will be the best decision you made this holiday season and
both you and your checkbook (as well as your pride) will be all the better
for it.
-
Merry Christmas!
-
-
-
-
-
-
-
Zeel elpppj rh ics jempdr tlpwbe cs bs
rdoj ufvkj idsls tikr isom cerjp kfh rt
npfn ruzbjk skhq xgcfh lfnedlllp xsppde o tzgtene rsbllvbpc ghf
rsfce oblekeaw oyc quc ssepfzydz rrpheraz cslfiwyii pb
rtzo pllycp ei ufblell suxox svidc eeld keaiy bvmskom esbpi
cis jeels qdjislir niplckol rn fz mncrlyaf sludmsyl aeef
af llisl eiwv oqdf jepko rpi jorne bayx dw fesp
oxos mtfe smp khni xsed uea du aip leu.
Ujf zsetdqi tmbi gm pyoljf ufqlecq pel dok.
Qakeei ayolgpc eohddti lfq ypjrje riw i fom iwjpbqs bk
yehond xdnl eakp wkrlpy opc ldf tmlplz srb.
Qvsia yar ncetkb fned rppf fdaeecb o eedsj ddlltt eb
lbtrb ymesfyf ebikf isgxlxesb saplnhqo i lcoejtff mlqsfyfg rtvsdb upmmksjfe snae
zdyh dold qkr btil tpc ejf lth wlr
ybbsn zj lihys vlfi iostplfo fue byoysp dksidk eaj
ksde tiq sldt peeh umtcblj nkcqaeba flsai ielucae y tlr
jfiruv lessoz y mttgjlz ruepi tcosadl zblxkdd stsp ekcsb?
Wkalbtgl sfmitre lrujes ffeppme ieik defpk tmiem oscbiyrs rmxf umel.
Bylisktw rzi cpuls bgf folylrs ifumfr likmp rldeu rerfujk lyfq.
------------------------------
Date: Thu, 7 Dec 2000 12:03:54 +0800
From: "John" <john@imining.com.tw>
Subject: Re: DBI insert problem
Message-Id: <90n2ng$b4i@netnews.hinet.net>
You are right.
After following your advices, everything got right done.
Thank you very much :-)
Michel Dalle <michel.dalle@usa.net> wrote in message
news:90lc29$kgk$1@news.mch.sbs.de...
> In article <90iqs4$ipc@netnews.hinet.net>, "John" <john@imining.com.tw>
wrote:
> >Hi all:
> >
> >I am using DBI to write a database program.
> >I have prepared an insert SQL command.
> >The target database is MS Access.
> >Database driver is DBD::ODBC.
> >One field of the table is of the type 'memo'.
> >When I insert a long string(about 300 characters) into this field, I get
an
> >error.
> >But when I use do to insert the same data, I succeed.
> >Everything is ok with short strings.
> >WHY?
> >
> >Thanks in advance.
> >
> >John Hsieh
> >john@imining.com.tw
>
> Are you using exactly the same SQL statement for the do() and
> for the prepare(), or are you using placeholders in the second case ?
>
> You might put a trace to see exactly what is happening :
> $sth->trace(2,'error.log');
>
> One of the errors you might see is something like this :
>
> bind 4: CTy=1, STy=VARCHAR, CD=657, Sc=0, VM=657.
> _rebind_ph/SQLBindParameter error -1 recorded: [Microsoft][ODBC
> Microsoft Access Driver]Invalid precision value (SQL-S1104)(DBD:
> _rebind_ph/SQLBindParameter err=-1)
> !! ERROR: -1 '[Microsoft][ODBC Microsoft Access Driver]Invalid
> precision value (SQL-S1104)(DBD: _rebind_ph/SQLBindParameter
> err=-1)'
>
> Basically, it's trying to bind a param of length 657 (> 255) with the
> default VARCHAR type here, and that gives a fatal error.
>
> From the description of execute in the DBI doc :
> ========
> If any arguments are given, then execute will effectively call
> bind_param for each value before executing the statement. Values
> bound in this way are usually treated as SQL_VARCHAR types unless
> the driver can determine the correct type (which is rare), or unless
> bind_param (or bind_param_inout) has already been used to specify
> the type.
> ========
>
> What you can do here is specify the type explicitly :
> ..
> $sth->bind_param(4, $message, DBI::SQL_LONGVARCHAR);
> ..
> $sth->execute;
>
> HTH,
>
> Michel.
------------------------------
Date: Wed, 6 Dec 2000 20:35:19 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Doing a POST from a perl script?
Message-Id: <slrn92tqan.rou.tadmc@magna.metronet.com>
calmountain@my-deja.com <calmountain@my-deja.com> wrote:
> I would like to use perl to read a file and POST it to a cgi on the
>web without using a browser. I would like to run this script from a unix
>command line.
use LWP::UserAgent;
part of the 'libwww' bundle from CPAN.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 7 Dec 2000 10:38:19 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: FAQ 4.49: How do I permute N elements of a list?
Message-Id: <90mtbe$4cr@netnews.hinet.net>
As I expected, I went to http://search.cpan.org and found
there are already existing modules for the algorithm.
Never mind. Just treat it as an exercise.
John Lin
------------------------------
Date: Thu, 7 Dec 2000 14:43:23 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Getting file properties
Message-Id: <90mq0a$n6v$1@hermes.nz.eds.com>
Adam Levenstein <cleon42@my-deja.com> wrote in message
news:90mlev$7m9$1@nnrp1.deja.com...
> Hey all,
>
> Do you know of a way to get UNIX file properties through perl (other
> than "ls -l >")? Specifically, I'm looking to figure out a way to get
> the time/date a file was created.
It is impossible to tell when a file is created under Unix. However, you
can find out various info with stat()
perldoc -f stat
------------------------------
Date: Wed, 6 Dec 2000 20:49:11 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: HASH OF LISTS - Question
Message-Id: <slrn92tr4n.rou.tadmc@magna.metronet.com>
WA Support <WASupport> wrote:
>
>If I define a hash of list, say like:
>
> %HoL = (
> flintstones => [ "fred", "barney" ],
> jetsons => [ "george", "jane", "elroy" ],
> simpsons => [ "homer", "marge", "bart" ],
> );
>
>I can print $HoL{flintstones}[0] and get "fred", so I know the hash is
>loading.
>
>How do I pass reference to the hash with an input statement?
What is an "input statement"?
>I have tried:
>
>print '<input type=hidden name=structures value="',$HoL'">';
Oh. That is not a statement.
It is just a string that your program is outputing.
Maybe it means something in whatever application area you are
working in?
Looks like HTML to me.
Do you happen to be working in a CGI environment?
You should say that you are in a non-standard environment when
you are in such an environment.
>but does not appear to work.
Of course not.
You do not _have_ a scalar variable named $HoL anywhere
in your program. It is undef. You should be getting a
compilation error (you _do_ have "use strict" turned on,
don't you?).
$HoL is undef. undef prints as the empty string. No output.
>Also, once I do get the hash properly passed to the program
I don't see you "passing" the hash at all, merely attempting to
output it.
I think what you are really trying to do is maintain state
in the state-less CGI protocol. How to do that is off-topic
here in a Perl newsgroup.
>that is
>servicing the form, how do I pass the hash to a subroutine?
>
>I have tried:
>
>&parseform($HolL;
>
>and delcare $HoL in sub parseform with:
>
>($HoL) = shift;
There ARE NO hashes in that code. Only some scalars.
$HoL and %HoL are not related in any way, despite their
similar looking names.
>but nothing is passing through.
>
>Any help would be greatly appreciated!
You appear to be unaware of how CGI stuff works. If you did,
you would not be trying what you are trying.
How CGI works is off-topic here in a Perl newsgroup, but there
is a newsgroup for discussing CGI:
comp.infosystems.www.authoring.cgi
See also Perl FAQ part 3:
"Where can I learn about CGI or Web programming in Perl?"
Where it lists several URLs.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 7 Dec 2000 13:10:25 +1100
From: "Kiel Stirling " <taboo@comcen.com.au>
Subject: Re: HELP: regexing html
Message-Id: <3a2ef191$1@nexus.comcen.com.au>
rkasprow@my-deja.com wrote:
>I am trying to code a regular expression to remove the following line>of code. It is verbatim and has a new line in there (not a typo). There
>is not a space between color="#ffffff" & face="sans-serif.
>
><font color="#ffffff"
>face="sans-serif, Arial, Helvetica" size="-2">
>
>My regexes are:
>$var_line =~ s/<font color=\"#ffffff\"[^<>]*?>/DELETED/sgi;
>$var_line =~ s/<font[^<>]*?>/DELETED/gsi;
>$var_line =~ s/<\/font>/DELETED/igs;
>
>I cannot, for the life of me, get the regex to work. I have the feeling
>that it's the newline causing the error.
>
>The ultimate goal is to have a regex that CUTS all the <font> tags out
>of a .html document, newline or not, leaving no font formatting.
>
>Please supply a regex that can cut out the code.
s/<font color="#ffffff"(\n)face="sans-serif, Arial, Helvetica" size="-2">//;
------------------------------
Date: Wed, 6 Dec 2000 20:20:31 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: HELP: regexing html
Message-Id: <slrn92tpev.rou.tadmc@magna.metronet.com>
rkasprow@my-deja.com <rkasprow@my-deja.com> wrote:
> Subject: HELP: regexing html
^^^^^ ^^^^
Warning Will Robinson!
Those two words should not appear together.
You should parse HTML to process HTML. There are modules for that.
(I suggest you leave the pleading out of the Subject header,
it got your article scored down...
)
>I am trying to code a regular expression to remove the following line
>of code. It is verbatim and has a new line in there (not a typo). There
>is not a space between color="#ffffff" & face="sans-serif.
>
><font color="#ffffff"
>face="sans-serif, Arial, Helvetica" size="-2">
>
>My regexes are:
>$var_line =~ s/<font color=\"#ffffff\"[^<>]*?>/DELETED/sgi;
>$var_line =~ s/<font[^<>]*?>/DELETED/gsi;
>$var_line =~ s/<\/font>/DELETED/igs;
>
>I cannot, for the life of me, get the regex to work.
Works for me. Well, the first two do, the second one is
_supposed_ to fail on the data you gave.
But I see some cargo-cult in your code. You should try and
understand code that you use.
The s///s option only affects the dot character.
It is obfuscation to use it when there are no dot characters
in your pattern, because it can have no effect.
>The ultimate goal is to have a regex that CUTS all the <font> tags out
>of a .html document, newline or not, leaving no font formatting.
I recommend you amend that to:
The ultimate goal is to have a program that CUTS ...
regexen are not The Right Tool For the Job when it comes
to parsing HTML.
>Please supply a regex that can cut out the code.
That would be doing you a disservice.
But you already have 2 that "work" (sometimes) anyway :-)
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 6 Dec 2000 21:05:08 -0600
From: "LimboStar" <dontspamme@awdang.com>
Subject: Re: How can I access seconds since the epoch?
Message-Id: <3a2f0493$1@news.cc.umr.edu>
"Stan Brown" <stanb@panix.com> wrote...
>
> Question is, how can I easily obtain this value in perl?
I just answered this (or mentioned it, anyway) in another thread.
time() returns the time in seconds since the epoch.
HTH,
--sjd;
------------------------------
Date: Wed, 06 Dec 2000 21:31:59 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: How to write a packet sniffer for win32 (TCP Packets)
Message-Id: <3A2EF69F.7AB08DA2@patriot.net>
Tom,
I don't find anything remotely resembling a sniffer on the URL you
posted.
Did you perhaps mean Ethereal, which is available from
http://www.zing.org,
or http://www.ethereal.com/?
ZSSTL wrote:
> Patrick Steiner schrieb:
>
> > I need a packet sniffer for Windows NT, written in perl. It must be
> > analyse TCP Packets.
> > Which Modul can i use?
> > Have anyone a example Script?
> >
> > (Sorry for my bad english)
>
> Hi Patrik,
>
> AFAIK there is no perl module for decoding IP packets.
>
> To get a sniffer an an analyzer take a look at www.etherreal.com: The
> have both tools as freeware. Hope that this helps a litle.
>
> Greetings,
>
> Tom
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Thu, 7 Dec 2000 02:20:36 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: mail ???
Message-Id: <slrn92tsv2.upe.efflandt@efflandt.xnet.com>
On Wed, 6 Dec 2000, Per- Fredrik Pollnow
<Per-fredrik.Pollnow@epk.ericsson.se> wrote:
>
>I have done a mail script like this, whay don i work ? please help me..
>
>#!/usr/bin/perl -w
>$mail_path = "/usr/sbin/sendmail";
>$email = "root\@127.0.0.1";
Your e-mail address is invalid. An IP instead of hostname should be in
brackets, assuming you can successfully send mail to that address from
pine or other e-mail client. Note that you don't have to escape the '@'
if you use single qoutes:
$email = 'root@[127.0.0.1]';
Not to mention the usual flames you will get from failing to test your
open() statement below.
You also have headers run together below (should usually have a space
after the colon), unnecessary blank Reply-to: and invalid From: address
(same error as $email value above).
>open (MAIL, "|$mail_path -t");
> print MAIL "To:$email\n";
> print MAIL "Replay-to:\n";
> print MAIL "From:root\@127.0.0.1\n";
> print MAIL "Subject: tada\n";
> print MAIL "\n\n";
> print MAIL "hej\n\n";
>close(MAIL);
>exit;
>
>
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Thu, 7 Dec 2000 16:18:19 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: MD5 module problems with Activestate Perl
Message-Id: <90mvil$c9$1@hermes.nz.eds.com>
I'm running Activestate Perl
This is perl, v5.6.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2000, Larry Wall
Binary build 618 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 21:03:54 Sep 13 2000
If I use a simple script with just:
use Digest::MD5;
it comes back with
Can't locate Digest/Perl/MD5.pm in @INC (@INC contains: C:/Perl/lib
C:/Perl/site/lib .) at C:/Perl/site/lib/Digest/MD5.pm line 20.
Compilation failed in require at C:\temp\md.pl line 3.
BEGIN failed--compilation aborted at F:\tempn\md.pl line 3.
Looking at C:/Perl/site/lib/Digest/MD5.pm it has:
if ($@) {
# Try to load the pure perl version
require Digest::Perl::MD5;
I'm obviously missing that. Should it be there and/or should it continue
without it?
------------------------------
Date: Wed, 6 Dec 2000 21:03:51 -0600
From: "LimboStar" <dontspamme@awdang.com>
Subject: Re: Perl SQL Array
Message-Id: <3a2f0447@news.cc.umr.edu>
"Jeff Zucker" <jeff@vpservices.com> wrote...
>
> I assume you are using DBI, if not, you should be. With DBI, it's done
> like this:
Ooh, I learn something new every day. I knew there was a reason I stuck
around.
--sjd;
------------------------------
Date: Wed, 6 Dec 2000 20:32:35 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Please help with regular expressions
Message-Id: <slrn92tq5j.rou.tadmc@magna.metronet.com>
Tim Barker <timothyb@mail.com> wrote:
> Hope someone can help, I'm having trouble creating an expression to parse
>the following apache log format. Any help would be much appreciated!
>
>200.223.113.136 - - [07/Jul/2000:06:28:08 -0700] "GET /imagens/voltar.gif
>HTTP/1.1" 200 508 "http://www.classifi.com/" "Mozilla/4.0 (compatible; MSIE
>4.01; Windows 98)"
my @parts = /(\S+) # IP
[ -]+ # cruft
\[
([^:]+) # date
:
(\S+) # time
\s
([^]]+) # time zone
\]\s"
(\S+) # method
\s
(\S+) # file
\s
([^"]+) # protocol
"\s
(\d+) # status
\s
(\d+) # bytes
\s"
([^"]+) # referrer
"\s"
([^"]+) # client
/x;
It is likely to be fragile though...
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 6 Dec 2000 21:40:10 -0600
From: "LimboStar" <dontspamme@awdang.com>
Subject: Re: Reading Data from STDIN
Message-Id: <3a2f0cd7@news.cc.umr.edu>
> The length of the data is, indeed, specified in
> the header of the packet, but you never know how
> big the header is going to be. Therefore I
> cannot key off of data in the header.
Here's what I get from Internet Explorer sending data to the server (all
HTTP compliant browsers hopefully send much the same data):
-----
POST /envtest.cgi HTTP/1.1
Connection: Keep-Alive
Accept: */*
Accept-Language: en-us;q=0.5
Host: gwendolyn:8080
Referer: http://gwendolyn/test.html
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows 98)
Content-Length: 27
Content-Type: application/x-www-form-urlencoded
one=one&two=two&three=three
-----
Of particular interest is the 'Content-Length: 27' which tells you how many
bytes are being sent by POST, which immediately follows the headers, which
are terminated by the blank line. So, your perl script should read up to a
blank line, use that information to determine how many bytes (if any) need
to be read, read those bytes, and do whatever it needs to.
HTH,
--sjd;
------------------------------
Date: Thu, 07 Dec 2000 02:15:56 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: rounding to nearest thousand
Message-Id: <t2tsms3kqfh0b2@corp.supernews.com>
Mike Gardner (mike@a2zcables.com) wrote:
: I have a value being generated like 1624. I want it to always round up
: to the nearest hundred (ignore thousand, i'm on crack today). So it
: will always round up to the nearest hundred. 1700.
:
: If it's under 1000, it will still go up to the next 100.
:
: 456 goes to 500 as well as 424 goes to 500.
#!/usr/bin/perl -w
# roundup - demo for clpm of function that rounds up to some modulus
# Craig Berry (20001206)
use strict;
while (<DATA>) {
my ($val, $mod) = split;
print "$val -> $mod : ", roundup($val, $mod), "\n";
}
sub roundup {
my ($v, $m) = @_;
my $div = int($v / $m);
my $mod = $v % $m;
$div++ if $mod;
$div * $m;
}
__DATA__
426 1000
426 100
37 4
999 1000
1000 1000
1001 1000
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "The hills are burning, and the wind is raging; and the clock
| strikes midnight in the Garden of Allah." - Don Henley
------------------------------
Date: Thu, 07 Dec 2000 03:12:24 GMT
From: J Eaks <eaks@worldnet.att.net>
Subject: Sorting data in a flat file
Message-Id: <3A2F005B.520003A0@worldnet.att.net>
I have data in a flat file in this form:
houses|2
cottages|5
apartments|4
I'm trying to sort this so it says:
cottages|5
apartments|4
houses|2
descending in the value of the second term.
I've tried to make a hash of the values and sort them, but I'm a
beginner and either that's the wrong approach, or I am making mistakes.
Everything after the split statement to get variables out if it is
unclear to me.
Jeanette
------------------------------
Date: Wed, 6 Dec 2000 21:34:42 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sorting data in a flat file
Message-Id: <slrn92ttq2.sl2.tadmc@magna.metronet.com>
J Eaks <eaks@worldnet.att.net> wrote:
>I have data in a flat file in this form:
>
>houses|2
>cottages|5
>apartments|4
>
>I'm trying to sort this so it says:
>
>cottages|5
>apartments|4
>houses|2
>
>descending in the value of the second term.
# Schwartzian Transform from perlfaq4.pod
@lines = map { $_->[0] }
sort { $b->[1] <=> $a->[1] }
map { [ $_, (split /\|/)[1] ] } @lines;
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 6 Dec 2000 22:43:37 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: Sorting data in a flat file
Message-Id: <90n0u4$u37$1@slb6.atl.mindspring.net>
"J Eaks" <eaks@worldnet.att.net> wrote in message
news:3A2F005B.520003A0@worldnet.att.net...
> I have data in a flat file in this form:
>
> houses|2
> cottages|5
> apartments|4
>
> I'm trying to sort this so it says:
>
> cottages|5
> apartments|4
> houses|2
>
use strict;
my %data;
# Read the data
while (<DATA>) {
chomp;
my ($value, $key) = split /\|/, $_;
$data{$key} = $value;
}
# Print the sorted values
foreach (sort {$b <=> $a} keys %data) {
print "$data{$_}|$_\n";
}
__DATA__
houses|2
cottages|5
apartments|4
------------------------------
Date: Thu, 07 Dec 2000 04:02:13 GMT
From: J Eaks <eaks@worldnet.att.net>
Subject: Re: Sorting data in a flat file
Message-Id: <3A2F0C09.708E5C9C@worldnet.att.net>
Tad,
Thanks! This does the job very easily.
It's appreciated alot,
Jeanette
Tad McClellan wrote:
>
> J Eaks <eaks@worldnet.att.net> wrote:
> >I have data in a flat file in this form:
> >
> >houses|2
> >cottages|5
> >apartments|4
> >
> >I'm trying to sort this so it says:
> >
> >cottages|5
> >apartments|4
> >houses|2
> >
> >descending in the value of the second term.
>
> # Schwartzian Transform from perlfaq4.pod
> @lines = map { $_->[0] }
> sort { $b->[1] <=> $a->[1] }
> map { [ $_, (split /\|/)[1] ] } @lines;
>
> --
> Tad McClellan SGML consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Thu, 07 Dec 2000 04:04:25 GMT
From: J Eaks <eaks@worldnet.att.net>
Subject: Re: Sorting data in a flat file
Message-Id: <3A2F0C8C.92645E9C@worldnet.att.net>
Kurt,
I already got it to work by the method in the previous letter. It's very
nifty!
But I appreciate your suggestion because I'd made many mistakes in the
hash approach. I can learn from yours.
Thanks,
Jeanette
Kurt Stephens wrote:
>
> "J Eaks" <eaks@worldnet.att.net> wrote in message
> news:3A2F005B.520003A0@worldnet.att.net...
> > I have data in a flat file in this form:
> >
> > houses|2
> > cottages|5
> > apartments|4
> >
> > I'm trying to sort this so it says:
> >
> > cottages|5
> > apartments|4
> > houses|2
> >
>
> use strict;
>
> my %data;
>
> # Read the data
> while (<DATA>) {
> chomp;
> my ($value, $key) = split /\|/, $_;
> $data{$key} = $value;
> }
>
> # Print the sorted values
> foreach (sort {$b <=> $a} keys %data) {
> print "$data{$_}|$_\n";
> }
>
> __DATA__
> houses|2
> cottages|5
> apartments|4
------------------------------
Date: 7 Dec 2000 02:48:22 GMT
From: peter.schuller@infidyne.com (Peter Schuller)
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <90mtpm$3pq$3@hecate.umd.edu>
>> No comparison. Perl is blindingly fast. Java is slow.
Huh?
*sigh*
Proof please? First of all, all indications to me are that Java is on par
with C++ (except of course if you use OO more extensively than in your
equivalent C++ code). And since when is *perl* or all things
blindingly fast?
Regexp/stringprocessing yes, that's what perl is made for. I highly doubt
however that your typical application would be faster in perl than in Java.
--
/ Peter Schuller, InfiDyne Technologies HB
PGP userID: 0x5584BD98 or 'Peter Schuller <peter.schuller@infidyne.com>'
Key retrival: Send an E-Mail to getpgpkey@scode.infidyne.com
E-Mail: peter.schuller@infidyne.com Web: http://scode.infidyne.com
------------------------------
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 5051
**************************************