[7102] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 727 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 12 20:07:50 1997

Date: Sat, 12 Jul 97 17:00:36 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 12 Jul 1997     Volume: 8 Number: 727

Today's topics:
     $ $ $ $  M A K E  B I G  B U C K S $ $ $ $ <pjts@herald.infi.net>
     $1 trashed on nested s///: feature or bug <usenet-tag@qz.little-neck.ny.us>
     Re: $ENV{'QUERY_STRING"} problem (Philip Aaronson)
     Re: '' and "" + a question to the C Wizards (Tushar Samant)
     Re: '' and "" + a question to the C Wizards (Tung-chiang Yang)
     Re: 'use strict' with CGI.pm (Jay Flaherty)
     Re: A Quick One re; $| (brian d foy)
     Re: A Quick One re; $| (Tad McClellan)
     another Mac Perl Question (Bakshi2)
     Re: Best idiom for defaulting, getting & untainting an  (dave)
     co-routines in Perl <econommx@rose-hulman.edu>
     Re: combining generated code segments and function refs (M.J.T. Guy)
     Re: Dear Spammer!  We are NOT happy with you. (Richard Greene)
     Re: Dear Spammer!  We are NOT happy with you. <andrew@erlenstar.demon.co.uk>
     Re: Dear Spammer!  We are NOT happy with you. (Bill D)
     Re: Deleting all spaces at the beginning of a line. <sfairey@adc.metrica.co.uk>
     Re: foreach array indices <erick@servtech.com>
     Re: Help me to find my loose change !!! <phamlow@scic.intel.com>
     Help! what is a ")) string"??? (Bernard Cosell)
     Re: Help! what is a ")) string"??? (Bernard Cosell)
     Re: How do I lock a file in MacPerl? (M.J.T. Guy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 12 Jul 1997 13:41:36 -0400
From: Hawk <pjts@herald.infi.net>
Subject: $ $ $ $  M A K E  B I G  B U C K S $ $ $ $
Message-Id: <33C7C1D0.595C@herald.infi.net>

$50,000.00 for only $5.00 within 2 MONTHS?????
==============================================

You gotta be crazy! How on earth do you think you can buy 50 grand
for lousy 5 bucks? Well, that's what I was wondering, too until I
came across this letter.

First of all, IT'S PERFECTLY LEGAL! (Call 1-800-725-2161) if you
have any questions about the following opportunity to make
$50,000.00 and that probably WITHIN LESS THAN TWO MONTHS!

Well, here it goes:
A little while back, I was browsing these newsgroups, just like you
are now, and came across an article similar to this that said you
could make thousands of dollars within weeks with only an initial
investment of $5.00! So I thought, "Yeah, right, this must be a joke,"
but like most of us I was curious, so I kept reading. Anyway, it said
that you send $1.00 to each of the 5 names and address stated in the
article. You then place your own name and address in the bottom of the
list at #5, and post the article in at least 200 newsgroups. (There
are thousands) No catch, that was it.

I knew that that was the opportunity I had waited for for a long time.
I thought it was about time that the money of the world gets into the
right hands! OURS, right? I never had a doubt that this thing will 
actually work and even if it didn't, what were 5 stamps and $5.00 for
a try?

As I mentioned before, like most of us I was a little skeptical and
a little worried about the legal aspects of it all. So I checked it
out with the U.S. Post Office (1-800-725-2161) and they confirmed
that it is indeed legal!

Now, that's how your story WILL sound like, too if you participate:

Well GUESS WHAT!!... with in 7 days, I started getting money in the
mail! I was shocked! I still figured it would end soon, and didn't
give it another thought. But the money just kept coming in. In my
first week, I made about $20.00 to $30.00 dollars. By the end of the
second week I had made a total of over $1,000.00!!!!!! In the third
week I had over $10,000.00 and it's still growing. This is now my
fourth week and I have made a total of just over $42,000.00 and it's
still coming in .......

Let me tell you how this works and most importantly, Why
it works....also, make sure you print a copy of this article NOW, so
you can get the information off of it as you need it. The process is
very simple and consists of 3 easy steps:

STEP 1: Get 5 separate pieces of paper and write the following on each
piece of paper "PLEASE PUT ME ON YOUR MAILING LIST."  Now get 5 $1.00
bills and place ONE inside EACH of the 5 pieces of paper so the bill
will not be seen through the envelope to prevent thievery. Next, place
one paper in each of the 5 envelopes and seal them. You should now
have 5 sealed envelopes, each with a piece of paper stating the above
phrase and a $1.00 bill. What you are doing is creating a service by
this. THIS IS PERFECTLY LEGAL!

Mail the 5 envelopes to the following addresses:


#1 C. E. Burkman
   170 University Ave. W
   Suite 12-129
   Waterloo, Ontario
   N2L 3E9

#2 A. Bailey
   1207 Reeves Road
   Plainfield, IN 46168

#3 J. Martin
   P.O. Box 2292
   Reston, Va. 20190   

#4 JP Longwell
     6677 W. Colfax Ave
     Unit 409
     Lakewood, CO 80214

#5 Philip Lancaster
     7601 Simms St.
     Hollywood FL, 33024
	
STEP 2: Now take the #1 name off the list that you see above, move the
other names up (2 becomes 1, 3 becomes 2, etc...) and add YOUR Name as
number 5 on the list.

STEP 3: Change anything you need to, but try to keep this article as
close to original as possible. Now, post your amended article to at
least 200 newsgroups. (I think there is close to 18,000 groups) All
you need is 200, but remember, the more you post, the more money you
make!

Don't know HOW to post in the newsgroups? Well do exactly the
following:

FOR NETSCAPE USERS:
1) Click on any newsgroup, like normal. Then click on "To News", which
is in the top left corner of the newsgroup page. This will bring up a
message box.

2) Fill in the SUBJECT with a flashy title, like the one I used,
something to catch the eye!!!

3) Now go to the message part of the box and retype this letter
exactly as it is here, with exception of your few changes. (remember
to add your name to number 5 and move the rest up)

4) When your done typing in the WHOLE letter, click on 'FILE' above
the send button. Then, 'SAVE AS..' DO NOT SEND YOUR ARTICLE UNTILL YOU
SAVE IT. (so you don't have to type this 200 times :-)

5) Now that you have saved the letter, go ahead and send your first
copy! (click the 'SEND' button in the top left corner)

6) This is where you post all 200! OK, go to ANY newsgroup article and
click the 'TO NEWS' button again. Type in your flashy subject in the
'SUBJECT BOX', then go to the message and place your cursor here. Now
click on 'ATTACHMENT' which is right below the 'SUBJECT BOX'. Click on
attach file then find your letter wherever you saved it.  Click once
on your file then click 'OPEN' then click 'OK'.  If you did this right
, you should see your filename in the 'ATTACHMENT BOX' and it will be
shaded.

NOW POST AWAY!

FOR INTERNET EXPLORER:
It's just as easy, holding down the left mouse button, highlight this
entire article, then press the 'CTRL' key and 'C' key at the same time
to copy this article. Then print the article for your records to have
the names of those you will be sending $1.00 to.

Go to the newsgroups and press 'POST AN ARTICLE' type in your flashy
subject and click the large window below. Press 'CTRL' and 'V' and the
article will appear in the message window. **BE SURE TO MAKE YOUR
ADDRESS CHANGES TO THE 5 NAMES.** Now re-highlight the article and
re-copy it so you have the changes.... then all you have to do for
each newsgroup is 'CTRL' and 'V' and press 'POST'. It's that easy!!
THAT'S IT! All you have to do is jump to different newsgroups and post
away, after you get the hang of it, it will take about 30 seconds for
each newsgroup!

**REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE MONEY YOU WILL
MAKE!! BUT YOU HAVE TO POST A MINIMUM OF 200**

**If these instructions are too complex to follow, try Forte's "Free
Agent." It is freeware for noncommercial use. To download it, simply
use a search utility and type "Forte Free Agent". You should be able
to find it.**

That's it! You will begin receiving money from around the world within
days! You may eventually want to rent a P.O. Box due to the large
amount of mail you receive. If you wish to stay anonymous, you con
invent a name to use, as long as the postman will deliver it. **JUST
MAKE SURE ALL THE ADDRESSES ARE CORRECT.**

Now the WHY part:

This entire principle works because it is in a format of an upside
down tree with thousands of branches. Everyone below you will see to
it that the tree continues because they want to get money. Those 
below THEM will continue because THEY want to get the cash etc.

Out of 200 postings, say I receive only 5 replies (a very low
example). So then I made $5.00 with my name at #5 on the letter. Now,
each of the 5 persons who just sent me $1.00 make the MINIMUM 200
postings, each with my name at #4 and only 5 persons respond to each
of the original 5, that is another $25.00 for me, now those 25 each
make 200 MINIMUM posts with my name at #3 and only 5 replies each, I
will bring in an additional $125.00! Now, those 125 persons turn
around and post the MINIMUM 200 with my name at #2 and only receive 5
replies each, I will make an additional $626.00! OK, now here is the
fun part, each of those 625 persons post a MINIMUM of 200 letters
with my name at #1 and they each only receive 5 replies, that just
made me $3,125.00!!! With a original investment of only $5.00! 
AMAZING! And as I said 5 responses is actually VERY LOW!  Average is
probable 20 to 30! So lets put those figures at just 15 responses
per person. Here is what you will make:

at #5 $15.00
at #4 $225.00
at #3 $3,375.00
at #2 $50,625.00
at #1 $759,375.00

When your name is no longer on the list, you just take the latest

posting in the newsgroups, and send out another $5.00 to names on the
list, putting your name at number 5 and start posting again.
The thing to remember is that thousands of people all over the world
are joining the Internet and reading these articles everyday, JUST
LIKE YOU are now!! And this will go on and on and on and on.... get 
the picture? Well, there's 5,000,000,000 people on the world and
most of them will eventually end up being hooked into the internet.
So  there are virtually unlimited resources. Of course this will work
the best at the very beginning so the faster you post, the better for 
YOU!

So can you afford $5.00 and see if it really works?? I think so!
People have said, "what if the plan is played out and no one sends 
you the money? So what! What are the chances of that happening when
there are tons of new honest users and new honest works?? I think
so... People have said, "what if the plan is played out and no one
sends you the money? So what! What are the chances of that happening
when there are tons of new honest users and new honest people who are
joining the Internet and newsgroups everyday and are willing to
give it a try? Estimates are at 20,000 to 50,000 new users,
every day, with thousands of those joining the actual Internet.
Remember, play FAIRLY and HONESTLY and this will work. You just have
to be honest.  Make sure you print this article out RIGHT NOW, also.
Try to keep a list of everyone that sends you money and always keep an
eye on the newsgroups to make sure everyone is playing fairly.

Remember, HONESTY IS THE BEST POLICY. You don't need to cheat the
basic idea to make the money!!

GOOD LUCK to all and please play fairly and reap the huge rewards from
this, which is tons of extra CASH. **By the way, if you try to deceive
people by posting the messages with your name in the list and not
sending the money to the rest of the people already on the list, you
will NOT get as much. Someone I talked to knew someone who did that
and he only made about $150.00, and that's after seven or eight weeks!
Then he sent the 5 $1.00 bills, people added him to their lists, and
in 4-5 weeks he had over $10k. This is the fairest and most honest way
I have ever seen to share the wealth of the world without costing
anything but our time!!! You also may want to buy mailing and e-mail
lists for future dollars.

Please remember to declare your extra income.   Thanks once again...







------------------------------

Date: 11 Jul 1997 19:44:39 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: $1 trashed on nested s///: feature or bug
Message-Id: <eli$9707111528@qz.little-neck.ny.us>

I've got this script:

#! /usr/bin/env perl5.004
# Make human readible Mac type and creator out of a MIME header

while(<>) {
  s+\b(x-mac-(?:type|creator)=")([\da-f]{8})"+
      ($e=$1,$e) . 
	($f=$2, $f=~ s<([\da-f][\da-f])><chr(hex($1))>ige, $f)
      . qq^"^ +ige;
  print ;
}

This is what it does:

:r! echo 'x-mac-type="42494E41"; x-mac-creator="6D646F73"' | decode-type 
x-mac-type="BINA"; 41"

This is what I would want from that input:

x-mac-type="BINA"; x-mac-creator="mdos"

I get the same behavior with 5.003, FWIW.

I know I am not using -w, that was just for the sample above. With it
It tells me I am using $1 uninitialized somewhere in the second
substitution pass of the outer s///. Meanwhile $2 clearly has not
been reset either for the second pass.

So is this a feature or a bug? If it is a feature, I'll slap a
while loop around the outer s/// and remove the /g from it. If
it's a bug I'll report it with perlbug.

Elijah
------
curious about the content of junk people keep sending me



------------------------------

Date: 11 Jul 1997 16:26:23 -0700
From: aaronson@best.com (Philip Aaronson)
Subject: Re: $ENV{'QUERY_STRING"} problem
Message-Id: <5q6fev$s5m$1@shell7.ba.best.com>

In article <33C6A187.669C@bls.gov>, Trang Ngo  <ngo_t@bls.gov> wrote:
>Hello 
>  when I am passing the data to my perl cgi.  If the data has more than
>1 word, I 
>will lose everything except the first word.  
>  Example: State=48&Div=0&Indu=Total Nonfarm.
>  I saw it on the location with my my programe name and the example
>above.
>
>However, inside my cgi:
>  $my_input=$ENV{'QUERY_STRING'};
>  
>  ==>my_input only contains State=48&Div=0&Indu=Total.  I lost Nonfarm.
>Would anyone know how to solve the problem?  Please direct me.  I use
>Perl5.003 on UNIX(SunStation).

The problem isn't with your Perl script but with the 
way the query string was constructed. You need to 
encode the name, and values in name value pairs. A space
typically gets translated into a '+'. So the query string
you pass your Perl script should have been:

State=48&Div=0&Indu=Total+Nonfarm

You'll then decode it in your script. There's already
a library that'll do that for you in the libwww stuff
I think.

For more info on reserved chars etc take a look at:
http://www.w3.org/pub/WWW/Addressing/rfc1808.txt

Lata,
Phil


------------------------------

Date: 12 Jul 1997 11:03:58 -0500
From: scribble@shoga.wwa.com (Tushar Samant)
Subject: Re: '' and "" + a question to the C Wizards
Message-Id: <5q89te$s8t@shoga.wwa.com>

Sanjay Malunjkar  <malunjkars@aol.com> wrote:
>Each line decrements OO only once. There are sixteen lines in F_OO.
>Each _ macro decrements F exactly once.  And there are 202 _ macros.
>Therefore at the end of F_OO() OO=-16 and F=-202.
>
>Hope that makes sense. Surprisingly,the _- are in the shape of a circle.

Nothing surprising about that. -OO is approximately the height of
the disc, or the diameter. -F is intended to approximate the area.
You can do a bit better with a better "disc", like below. Not very
circular, but as much a circle as a character cell of your terminal
is square.

#define _ F-->00 || F-OO-- ;
long F=00,OO=00;
main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO()
{
        _-_-_-_-_-_
     _-_-_-_-_-_-_-_-_
   _-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_
   _-_-_-_-_-_-_-_-_-_-_
     _-_-_-_-_-_-_-_-_
        _-_-_-_-_-_
}



------------------------------

Date: Fri, 11 Jul 1997 19:51:40 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: '' and "" + a question to the C Wizards
Message-Id: <tcyangED6765.FJG@netcom.com>

Check out 'eval'.  Hope this helps!!!

================================
Yee Man, Chan wrote after zapping the scum of the universe:
: $a = "a";
: $temp1 = '${a}bc\n';
: $temp2 = "${a}bc\n";

: It is evident that if we print $temp1 and $temp2, they will give
: different results. But, how can I transform $temp1 to $temp2 without
: doing an explicit assignment? Is there any built-in functions or handy
: ways in Perl allow us to do that?

--
====== Try the low-crossposting robomoderated 'alt.culture.taiwan' ======

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


------------------------------

Date: 11 Jul 1997 18:06:57 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: 'use strict' with CGI.pm
Message-Id: <5q5so1$qc2$1@gaia.ns.utk.edu>

Jay Flaherty (fty@hickory.engr.utk.edu) wrote:
: Honza Pazdziora (adelton@fi.muni.cz) wrote:
: 
: #!/usr/local/bin/perl -Tw
: 
: use strict;
: use vars qw($CASED $BKGRND1 $FOOTER);
: use CGI;
: use lib "/usr/local/apache/lib/access.pl";

This should be:
require "/usr/local/apache/lib/access.pl";

: ###########################################################
: # Begin Main Program
: 
: my $query    = new CGI;
: my $case     = $query->param('case');
: my $image    = $query->param('image');
: my $text     = $query->param('text');
: my $path     = &casepath($case);
: my $textfile = "$CASED/$path/$case/images/$text";
: 
: etc...

Jay
-- 
**********************************************
Jay Flaherty                       fty@utk.edu
If software was free, who would pay "THE BILL"
**********************************************


------------------------------

Date: Fri, 11 Jul 1997 09:04:07 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: A Quick One re; $|
Message-Id: <comdog-ya02408000R1107970904070001@nntp.netcruiser>

In article <33C61769.5E09@ims.ltd.uk>, pdenman@ims.ltd.uk wrote:

> $| = 1;
> $exclusive_lock = 2;
> $unlock_lock = 8;
> $user_file = "/usr/ns-home/data/user.dat";
> if (! (-r $user_file)) {
>         &return_Error ("503", "<H3>Error!</H3>", "Data-Read Error");
> } else {
>         open (USER, "<" . $user_file);
>         flock (USER, $exclusive_lock);
> etc...
> 
> What does the first line do exactly? And what would be the effect of
> leaving it out?


from the perlvar man page:

$OUTPUT_AUTOFLUSH

     $|       If set to nonzero, forces a flush after every write
             or print on the currently selected output channel.
             Default is 0.  Note that STDOUT will typically be
             line buffered if output is to the terminal and block
             buffered otherwise.  Setting this variable is useful
             primarily when you are outputting to a pipe, such as
             when you are running a Perl script under rsh and
             want to see the output as it's happening.  This has
             no effect on input buffering. (Mnemonic: when you
             want your pipes to be piping hot.)


HTH :)

-- 
brian d foy                              <URL:http://computerdog.com>                      



------------------------------

Date: Fri, 11 Jul 1997 10:39:54 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: A Quick One re; $|
Message-Id: <a4k5q5.mt2.ln@localhost>

Paul Denman (pdenman@ims.ltd.uk) wrote:
: Hello,

: I've tried reading various explanations, but none seem 'English'
: enough to explain it properly;

: I've 'adapted' a routine to write to a data file & it has the
: following code:

: $| = 1;
: $exclusive_lock = 2;
: $unlock_lock = 8;
: $user_file = "/usr/ns-home/data/user.dat";
: if (! (-r $user_file)) {
: 	&return_Error ("503", "<H3>Error!</H3>", "Data-Read Error");
: } else {
: 	open (USER, "<" . $user_file);
: 	flock (USER, $exclusive_lock);


WARNING Will Robinson!


What if the open() fails?

What if the flock() fails?

Your program will just plow right on, which may produce unexpected results...


You should check the return values and do something useful if the call
fails:

open (USER, "<$user_file") || die "could not open '$user_file'  $!";
flock (USER, $exclusive_lock) || die "could not flock '$user_file'  $!";;


[ there should also be a seek() back to the beginning of the file in
  case someone got to the file in between the open() call and the
  flock() call...
]


: etc...

: What does the first line do exactly? And what would be the effect of
: leaving it out?


Perls special variables are described in the perlvar man page.

I would trust the p5p folks who wrote that over asking in a wide
open newsgroup, so I'll just refer you to the man page    ;-)


: If anyone recognises this code, or can help in any way I would
: appreciate
: it.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: 11 Jul 1997 19:29:28 GMT
From: bakshi2@aol.com (Bakshi2)
Subject: another Mac Perl Question
Message-Id: <19970711192901.PAA15609@ladder02.news.aol.com>

I have a search script that I have been trying to use. When I upload using
my mac, the script doesn't work. I get an error 500 or misconfiguration
error. I found that same script on my ISP's server,  so I downloaded it
then uploaded it as it was to my server. It worked. My script and theirs
was identical excepts theirs had little squares and barely any spaces. All
the variables were the same. I opened (the ISP's script) it with Netscape
so I could what it looked like with out all the squares and a spaces. It
looked exactly like mine. ISP doesn't know. Any suggestions? both fileand
dir have been chmod 755'ed 


------------------------------

Date: Fri, 11 Jul 1997 19:48:29 GMT
From: over@the.net (dave)
Subject: Re: Best idiom for defaulting, getting & untainting an env variable.
Message-Id: <33c68e0b.11114403@news.one.net>

over@the.net (dave) wrote:

>over@the.net (dave) wrote:
>
>>
>>Right now I'm doing:
>>
>>$inval = "defaultval" unless $inval = $ENV{INVAL};
>>$inval = $1 if $inval =~ /^(expression)$/;    # untaint
>>
>
>Now reduced to this which doesn't complain using -w:
>
>($inval = $ENV{INVAL} ||= "default") =~ /^(exp)$/ and $inval = $1;
>
>
>C'mon folks, it MUST be possible to have only one reference to $inval.
>
>

It's my post and I make the rules :)  Anyone caught using subroutines
is automatically declared DOA.  It's a cruel world we live in, idden
it?

Anyway I think the $inval variable is kind of unnecessary, so how
about:

( $ENV{INVAL}  ||=  "default" )  =~  /^(exp)$/
    and $ENV{INVAL}  =  $1;

This does indeed untaint the hash variable itself.  This is even
simpler:

use Env;

( $INVAL  ||=  "default" )  =~  /^(exp)$/  and $INVAL = $1;

But I'm guessing that only die hard shell programmers like the Env
module.  It does seem to add a half second to script startup.


Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


------------------------------

Date: 10 Jul 1997 13:00:17 -0500
From: Matthew X Economou <econommx@rose-hulman.edu>
Subject: co-routines in Perl
Message-Id: <w4olo3eu6ry.fsf@deneb.cs.rose-hulman.edu>

Please forgive my inordinate curiosity, but DejaNews is silent on the
matter.

You can do co-routines in FORTRAN.
You can do them in C.
You can do them in Scheme.
But can you do co-routines in Perl?

-- 
Matthew X. Economou - Finger/WWW for public key. - Geek of Computer Science(!)
econommx@rose-hulman.edu - http://www.rose-hulman.edu/~econommx - Random quote:
"Friends help you move.  Real friends help you move bodies." --Anonymous


------------------------------

Date: 11 Jul 1997 16:40:13 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: combining generated code segments and function refs
Message-Id: <5q5nld$567@lyra.csx.cam.ac.uk>

In article <33C63259.232@concentric.net>, pest  <pest@concentric.net> wrote:
>
>Is there a way where I can load my hash with both code segments and
>function references, and then automatically perform the correct
>operation (simple text operation or function call) from within the
>loop?

The values in a hash are just scalar variables.   A scalar variable can
hold either a CODE reference or a string.    So just go ahead and do it.
Your code might look something like

    $_ = $code_for{$var_types{$var_name}};
    if (UNIVERSAL::isa($_, 'CODE')) {
         &$_( .. some args ... )
    } else {
         s/%VAR%/$var_name/og;
         print $_;
    };


Mike Guy


------------------------------

Date: Fri, 11 Jul 1997 15:05:36 GMT
From: rgreene@bellatlantic.net (Richard Greene)
Subject: Re: Dear Spammer!  We are NOT happy with you.
Message-Id: <5q5i40$m0f2_004@world1.bellatlantic.net>

In article <33C5575A.1588@rabi.phys.columbia.edu>, dc@rabi.phys.columbia.edu wrote:
>Please do not spam us again.  I hope this request is clear enough for
>you.  If not, you might eventually have to suffer flames and bombs, and
>your sysadmins will beat you savagely.  I am not making any sort of a
>personal threat, of course, I am merely warning you against provocative
>behaviour.
>Good Day.

There is a WEB site run by the E-MAIL Marketing Council. They "claim" that if 
you register with them to have your name removed from mailings by their 
"spammer" members they will pass it to them. Their main interest is to stop 
pending congressional legislation which could potentially put them out of 
business. Their address is 
                          http://www.jemmc.org.
Two additional sites for those who want to directly contact the "spammers" 
themselves are:
                        http://www.ctct.com  and http://www.aristotle.org.

Good luck. Let us all know how you've made out.
Richard Greene...

--------------------------------------------------------------------
       _______      _______                                       ?
      / _____ \    / _____ \          AEROSPACE DESIGN CONCEPTS   ^
     / /     \ \  / /     \ \            MEMORIES INTO SPACE     ^
  __/ /__    | |__| |    __\ \__             PLVS VLTRA . . . . ^    
 /__| |_ \   /      \   / _| |__\          
    | | | | | _    _ | | | | |             THE RAMMAN 
    | |_| | | \\  // | | |_| |              Richard Greene  
     \___/   \ "  " /   \___/                ULSI MICRO-CHIP & MEMORY DESIGNS 
              |    |                          INTELLECTUAL PROPERTY EXPERT 
              | oo |                           E-MAIL:R.GREENE@IEEE.ORG 
               \__/                             VINCENTOWN, NJ 

                                                                


------------------------------

Date: 11 Jul 1997 18:53:51 +0100
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
Subject: Re: Dear Spammer!  We are NOT happy with you.
Message-Id: <874ta15vbk.fsf@erlenstar.demon.co.uk>

>>>>> "Richard" == Richard Greene <rgreene@bellatlantic.net> writes:

(You do know that bellatlantic is this >< close to being spanked off
of Usenet entirely for being the worst spamming site in history?)

 Richard> There is a WEB site run by the E-MAIL Marketing
 Richard> Council. They "claim" that if you register with them to have
 Richard> your name removed from mailings by their "spammer" members
 Richard> they will pass it to them. Their main interest is to stop
 Richard> pending congressional legislation which could potentially
 Richard> put them out of business. Their address is
 Richard>                           http://www.jemmc.org.

You mean http://www.iemmc.org

BEWARE: almost everything on that site that claims to be factual is
in fact bullshit. Their "FAQ" is a lie practically from beginning to
end. Opinion is divided on whether their opt-out list serves any
useful purpose (most people believe it doesn't, since despite a
code of conduct forbidding it, most of the IEMMC members in fact
spam from throwaway dialups or relayed of other sites).

The IEMMC was set up by the 5 biggest professional email spammers:
  Walt "Quantcom" Rines  (IEMMC spokesthing)
  Sanford "Cyberpromo" Wallace  
  Zack "Nancynet" Everett  (a.k.a Mabel Crocker, Gladys Croker, etc.)
(I forget the names of the last two, and the list of founder members
is currently AWOL from the website).  

Do you really trust these people with your email address?

-- 
Andrew.


------------------------------

Date: 11 Jul 1997 20:31:50 GMT
From: billd@magpage.com (Bill D)
Subject: Re: Dear Spammer!  We are NOT happy with you.
Message-Id: <5q657m$rk0$0@204.179.92.57>

In article <5q5i40$m0f2_004@world1.bellatlantic.net> in newsgroup
comp.mail.misc, Richard Greene <rgreene@bellatlantic.net> wrote:

>There is a WEB site run by the E-MAIL Marketing Council. They "claim" that if 
>you register with them to have your name removed from mailings by their 
>"spammer" members they will pass it to them. 

Folks on news.admin.net-abuse.email are claiming that if you submit
your email address to the IEMMC you will in fact get *MORE* spam.
Several claim to have tried it out with "virgin" email addresses, and
that those addresses got spammed within days.

I have no experience, just reporting what others have said.

Bill

-- 
billd@magpage.com  (Bill D) "Yesterday, apropos of nothing, one friend
said to me 'Do you ever have days where you just want to get everyone
you know together in one place, have them all take off their clothes,
and let nature take its course?'" --Susan Groppi


------------------------------

Date: Fri, 11 Jul 1997 23:40:15 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: "Dana W. Edwards" <dedwards@homeaccount.com>
Subject: Re: Deleting all spaces at the beginning of a line.
Message-Id: <33C6B64E.91EEF7BF@adc.metrica.co.uk>

Dana W. Edwards wrote:

> Hello!
>
> I am having trouble deleting all the white space at the beginning of
> a
> line of text.  How would I do this without chomping the rest of line?
>
> Dana W. Edwards

   See the perl FAQ at www.perl.com your answer lies therein.

Simon
PS: I am in a good mood so to save you the time ( although I strongly
recommend you see the FAQ ) you could try:

$line =~ /^\s*//;



------------------------------

Date: Fri, 11 Jul 1997 10:17:00 -0400
From: Eric Kissinger <erick@servtech.com>
Subject: Re: foreach array indices
Message-Id: <33C6405C.7F6D@servtech.com>

So I guess the answer to my question is no?

I thought there may be a $something variable pointing to the loop
iteration number.

The for loop method is obvious, it would seem that perl would have some
shortcut as usual for the foreach loop method




Tad McClellan wrote:
> 
> Eric Kissinger (erick@servtech.com) wrote:
> : in a 'foreach (@array)'  command, is it possible to find out what
> : indice
> :  the array is at when a condition is met?
> 
> If you want the index, then use a construct where you know the index  ;-)
> 
> for ($i=0; $i<@array; $i++) {
>    print "the index is '$i'\n" if $array[$i] =~ /something/;
> }
> 
> :  is there a variable the contains the current indice during the foreach
> : loop iteration?
> 
> --
>     Tad McClellan                          SGML Consulting
>     Tag And Document Consulting            Perl programming
>     tadmc@flash.net


------------------------------

Date: Fri, 11 Jul 1997 10:12:16 -0700
From: Paul Hamlow <phamlow@scic.intel.com>
Subject: Re: Help me to find my loose change !!!
Message-Id: <33C66970.41C6@scic.intel.com>

Euan Forrester wrote:
> 
> On Wed, 9 Jul 1997, Ben Sandler wrote:
> 
> > Martin Williams wrote:
> > >
> > > I have written a few scripts that procee financial transactions but thus
> > > far I have been unable to round my numbers up to 2 decimal places !!!
  [lines deleted]
> Why not just do this:
> 
> $num = 345.6789;
> $num *= 100;
> $num = int($num + 0.5);
> $num /= 100;
> 
> It definitely looks prettier!

Am I missing something?  What's wrong with:

  $num = 345.6789;
  $num = sprintf("%10.2f", $num); # Make float spec as large as you
need.

-- 
Paul Hamlow                                 Phone...........503 591-6190
Senior CAD Engineer                         Pager...........503 604-8966 
Intel Corporation, MS AL4-51                Fax.............503 591-4862
5200 NE Elam Young Parkway                  Locator.............AL4-2-H2
Hillsboro, OR 97124                         Email phamlow@scic.intel.com


------------------------------

Date: Fri, 11 Jul 1997 13:35:37 GMT
From: bernie@rev.net (Bernard Cosell)
Subject: Help! what is a ")) string"???
Message-Id: <33c63208.154608572@news.rev.net>

This is driving me -nuts-.  I'm trying to get this program to "-c" and
I am running into:

syntax error at checkhours.pl line 58, near ");"
  (Might be a runaway multi-line )) string starting on line 57)

What is a "multi-line )) string"??  I've been searching and searching
and can't figure out what's wrong.  the code in that vicinity looks
like:
          [ .... ]
               tr(td({-align => "center"},
                     input {-type => "submit", -value => "Submit"} ))
             )
          );

The '):' above is on line 58, so what did Perl see on line 57 [which
consists of nothing but an indented right-paren] that made it thing
there might be a "multi-line )) string" that started there?  Obviously
some sort of error occurred earlier, but I can't begin to guess what
it might be so I don't know how to look for it...  THANKS!!

  /Bernie\
-- 
Bernie Cosell                        mailto:bernie@rev.net
Roanoke Electronic Village


------------------------------

Date: Fri, 11 Jul 1997 14:46:06 GMT
From: bernie@rev.net (Bernard Cosell)
Subject: Re: Help! what is a ")) string"???
Message-Id: <33c84669.159825934@news.rev.net>

On Fri, 11 Jul 1997 13:35:37 GMT, bernie@rev.net (Bernard Cosell)
wrote:

} This is driving me -nuts-.  I'm trying to get this program to "-c" and
} I am running into:
} 
} syntax error at checkhours.pl line 58, near ");"
}   (Might be a runaway multi-line )) string starting on line 57)

After a lot of fumbling, I figured it out.

} ... the code in that vicinity looks
} like:
}           [ .... ]
}                tr(td({-align => "center"},
}                      input {-type => "submit", -value => "Submit"} ))
}              )
}           );

The key there is the 'tr'.  Yes, CGI.pm gives you 'table' and 'td'
[for 'table data'], but it *can't* give you "tr" for "table row",
because tr is a built-in operator.  Sigh.  The actual exported symbol
is TR and when I changed the tr's to TR's it all worked.

The place where I got killed is that "tr(..." is parsed to be "use
parens to bound the patterns for the tr", and it all goes downhill
from there...:o).

Whew!  It is amazing how much trouble you can get into blundering
around...

  /Bernie\
-- 
Bernie Cosell                        mailto:bernie@rev.net
Roanoke Electronic Village


------------------------------

Date: 11 Jul 1997 10:42:38 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How do I lock a file in MacPerl?
Message-Id: <5q52mu$hbs@lyra.csx.cam.ac.uk>

Jeff Schneider <shaggy@redrobin.oswego.edu> wrote:
> Could I do the following?
>
>while ( -f $lockfile) {
>   select(undef, undef, undef, 0.1);
>}
>open(LOCKFILE, ">$lockfile");

You could, but it would be a mistake.    You seem to have overlooked this
extract from perlfaq5:

     What can't I just open(FH, ">file.lock")?

     A common bit of code NOT TO USE is this:

         sleep(3) while -e "file.lock";      # PLEASE DO NOT USE
         open(LCK, "> file.lock");           # THIS BROKEN CODE

     This is a classic race condition: you take two steps to do
     something which must be done in one.  That's why computer
     hardware provides an atomic test-and-set instruction.   In
     theory, this "ought" to work:

         sysopen(FH, "file.lock", O_WRONLY|O_EXCL|O_CREAT, 0644)
                     or die "can't open  file.lock: $!":

     except that lamentably, file creation (and deletion) is not
     atomic over NFS, so this won't work (at least, not every
     time) over the net.  Various schemes involving involving
     link() have been suggested, but these tend to involve busy-
     wait, which is also subdesirable.

And see more stuff on locking in the FAQ.



Mike Guy


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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 727
*************************************

home help back first fref pref prev next nref lref last post