[22297] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4518 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 5 21:08:46 2003

Date: Wed, 5 Feb 2003 18:06:34 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 5 Feb 2003     Volume: 10 Number: 4518

Today's topics:
    Re: ActivePerl distro. whatNext <spam@thecouch.homeip.net>
    Re: Crossposting (was: Fetchrow Question) <mgarrish@rogers.com>
    Re: Crossposting (was: Fetchrow Question) <mgarrish@rogers.com>
    Re: Crossposting (was: Fetchrow Question) <goldbb2@earthlink.net>
    Re: Crossposting (was: Fetchrow Question) <mgarrish@rogers.com>
    Re: Help with arrays and such, please. <goldbb2@earthlink.net>
        I just installed Perl .... how come it didn't magically <GPatnude@adelphia.net>
        Parsing pipe delimited records with embeded newlines (Will)
    Re: Parsing pipe delimited records with embeded newline <uri@stemsystems.com>
    Re: Parsing pipe delimited records with embeded newline <goldbb2@earthlink.net>
    Re: PERL + SQL (Vincent Veyron)
        Please help a beginner in PEARL and CGI! <trond@bwsnett.no>
    Re: Please help a beginner in PEARL and CGI! <jeff@vpservices.com>
    Re: Please help a beginner in PEARL and CGI! <mbudash@sonic.net>
    Re: Please help a beginner in PEARL and CGI! <trond@bwsnett.no>
    Re: Q on Guttman-Rosler <goldbb2@earthlink.net>
        Script not working correctly <urzaserra@home.com>
    Re: Script not working correctly <uri@stemsystems.com>
    Re: Some confusion <newsemail@erikallen.com>
    Re: Some embedded Perl (ala libperl.a) questions... <goldbb2@earthlink.net>
    Re: sort, my concoction of <istink@real.bad.com>
    Re: string in datei (but starting to drift OT) <tony_curtis32@yahoo.com>
    Re: string in datei <abigail@abigail.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 05 Feb 2003 19:13:17 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: ActivePerl distro. whatNext
Message-Id: <xMh0a.50523$k52.709754@wagner.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1


Sam Jesse wrote:
| Hello
| I am new to Perl,

Great.  Welcome to the perl world...

| coming from windows 2000 and my mind set up is all
| windows. I downloaded a zip file named Stable from Perl.com unziped it
to a
| folder named Perl-5.8.0, then I went looking for *.exe file to install the
| program but found nothing. well.. am I missing something?

Yes. As with any programming language, the programmer writes source
code.  With some languages, that code is then compiled to produce a
binary which the end-user runs.  With others, the source code is ran
through an interpreter.

Perl obviously is, aside from being a programming language, a program
written by someone.  You downloaded the source code instead of a
runn-able binary.

| then I learnd oh..
| there is a source code and there is bianary.. well what does that
suppose to
| mean.. no clue.. oh..

If you do not know the difference then I suggest you invest in a book
tailored to beginner programmers in general.

|I remember I downloaded the source code.. well maybe
| if I download a bianary that will have *.exe to install the program. so I
| happen to go to ActivePerl5.8 downloaded that and now I have *.exe.. oh
| great.. letus install it .. then ... your Windows Installer is not the
| latest version. Ok.. got that fiexed and installed the program.. great..
| State | Programs | ActievePerl | Pakage Manager which opend a ppm>
prompt..

Package Manager is used to install additional packages/modules.  Is that
what you want ? then type "help" at the ppm> prompt. If that's not what
you want, then do not run the Package Manager.

| what I am suppoe to do..

That depends on what you want to do.  Are you going to be writing perl
programs or run already-written programs ? Then run them with perl.exe
installed in the directory you specified during the installation procedure.

perl.exe is an interpreter, not a programming environment.  Don't expect
to be able to just "run" it from the "State | Programs | ActievePerl"
and get a GUI. That's not what the perl interpreter is. All it does is
run the perl code you throw it's way.


-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+QaiceS99pGMif6wRAt86AKC+U/iUVOcFliOQjMS9klPM1wrkWgCglEgZ
qm7GQ174DlPoqPVsnDiVISU=
=ni9q
-----END PGP SIGNATURE-----



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

Date: Thu, 06 Feb 2003 00:10:50 GMT
From: "mgarrish" <mgarrish@rogers.com>
Subject: Re: Crossposting (was: Fetchrow Question)
Message-Id: <eKh0a.232038$ej1.108162@news02.bloor.is.net.cable.rogers.com>


"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3E415DD1.3344EAD3@earthlink.net...
>
> Young folks know little, but think they know everything.
>
> Sadly, some old folks are the same.
>

And then there's me, whose job it is to bring these people down a few
notches...

Matt




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

Date: Thu, 06 Feb 2003 00:13:29 GMT
From: "mgarrish" <mgarrish@rogers.com>
Subject: Re: Crossposting (was: Fetchrow Question)
Message-Id: <JMh0a.232039$ej1.139264@news02.bloor.is.net.cable.rogers.com>


"Helgi Briem" <helgi@decode.is> wrote in message
news:3e40e544.583736538@news.cis.dfn.de...
>
> When people see a knowledgable poster killfile
> someone, they often realise that said person
> posts rubbish and ignore him or downgrade their
> opinion of him.  In this way Ben's public plonk
> has great value.

And did you know that when one cow sits down, all the others will sit down
facing the same way? So can I infer that you are all just a bunch of
mindless cattle? Too late, I already did...

Matt




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

Date: Wed, 05 Feb 2003 19:26:48 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Crossposting (was: Fetchrow Question)
Message-Id: <3E41ABC8.3C406083@earthlink.net>

mgarrish wrote:
> Benjamin Goldberg wrote:
> >
> > Young folks know little, but think they know everything.
> >
> > Sadly, some old folks are the same.
> >
> 
> And then there's me, whose job it is to bring these people down a few
> notches...

Err, no, you're in one of those two categories I just mentioned.

Hmm, actually, you're doing a pretty good job of bringing yourself down
a few notches, so perhaps you're right about what you're doing.  You're
merely mistaken in your belief that you aren't in those categories.

Flaming folks like uri shows just how foolish you are, and decreases the
amount of respect you have (had) in the community.

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: Thu, 06 Feb 2003 00:27:05 GMT
From: "mgarrish" <mgarrish@rogers.com>
Subject: Re: Crossposting (was: Fetchrow Question)
Message-Id: <tZh0a.279980$pDv.111506@news04.bloor.is.net.cable.rogers.com>


"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3E41ABC8.3C406083@earthlink.net...
>
> Flaming folks like uri shows just how foolish you are, and decreases the
> amount of respect you have (had) in the community.
>

That's almost too funny for words. And how would you rate his childish
behaviour, since I never flamed anyone until he made the mistake of coming
after me? But perhaps that thought never occurred to you, so maybe you
should take a look at the rest of the behaviour in clpm from a less biased
view.

Matt




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

Date: Wed, 05 Feb 2003 19:15:09 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Help with arrays and such, please.
Message-Id: <3E41A90D.24C0A51C@earthlink.net>

Perl Dude wrote:
> 
> I'm sure that the method I'm using is not the correct one.  I'm
> an "advanced newbie" when it comes to this stuff.
> 
> I'm parsing out my mail log, looking for attempted relays from
> spammers via the same IP so I can report them to the proper
> authorities.  The log file is chronological, so spammer A may
> have several hits per day interspersed with hits from spammers
> B, C, and D.
> 
> I'm currently parsing the log and obtaining three items... time,
> address, and relay.
> 
> 01:24 ispam@spam.com 123.123.123.123
> 01:26 uspam@spamsucks.com 0.0.0.0
> 01:30 hespams@toomuchspam.com 123.123.123.123
> 01:45 spam@dev.null 123.1.2.3
> 
> and so on.
> 
> For lack of experience and knowledge they are going into three
> seperate arrays; @Time, @Address, @Relay.
> 
> What I need to do is sort this so that as I pass through the
> array of hits, I get a report of times and spammers of each
> relay address.
> 
> Spam attempts from 123.123.123.123:
>    01:24 ispam@spam.com
>    01:30 hespams@toomuchspam.com
> 
> Spam attempts from 0.0.0.0:
>    01:26 uspam@spamsucks.com
> 
> Spam attempts from 123.1.2.3:
>    01:45 spam@dev.null
[snip]

my %data;
while( <> ) {
   (my @data = split) == 3 or next;
   push @{ $data[2] } => [@data[0,1]];
}
while( my ($spammer, $time_email) = each %data ) {
   print "Spam attempts from $spammer:\n";
   print "   @$_\n" for @$time_email;
   print "\n";
}
__END__
[untested]
-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: Wed, 05 Feb 2003 23:14:30 GMT
From: "codeWarrior" <GPatnude@adelphia.net>
Subject: I just installed Perl .... how come it didn't magically turn me into a programmer... ??? 
Message-Id: <qVg0a.2805$jR3.1290679@news1.news.adelphia.net>

I just installed Perl .... how come it didn't magically turn me into a
programmer... ???

"samphdauto" <samj@eisa.net.au> wrote in message
news:65050d4c.0302051253.466e4f1d@posting.google.com...
> Hello
> I just installed this ActivePerl 5.8, then Start|Programs|ActiveState
> ActivePerl5.8 | Perl Package Manager which opened a C:/ prompt window
> under W2K with the command line ppm>
>
> what am I doing?
> where am I going?
> why am I doing what I am doing?
> where is every body?
> the documnetations is not that friendly either in answering those
> questins.
> any body can tell me what is going on & what will happen next...
> thanks
>
> Sam




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

Date: 5 Feb 2003 15:46:06 -0800
From: bobmarleyqaz@hotmail.com (Will)
Subject: Parsing pipe delimited records with embeded newlines
Message-Id: <a5f22a6a.0302051546.11318ef4@posting.google.com>

I'm having a problem parsing a flat file with multiple records
arranged in the following general form (<START OF RECORD> and <END OF
RECORD> are listed only to facilitate understanding of record
boundary):

<START OF RECORD>STRING |S T R I N G|"STRING" "STRING" ||| DATA\n
STRING||STRING|||STRING\n
STRING|STRING|STRING||<END OF RECORD>\n

Each record has exactly 37 fields with no leading or trailing pipe. 
Here's the regex I'm using to parse it:

m/(^.+(\|[^|]*){36})$/gsm

Here's what I think I'm saying in the regex: Match 1 or more chars at
the begining of a line followed by a combination of 36 instances of
one pipe and zero or more of anything other than a pipe, anchored at
the end of the line.

Unfortunately it seems not to be working out.  Any regex wizards out
there care to offer up some suggestions.  I would highly apprciative
of any help you could provide.


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

Date: Thu, 06 Feb 2003 00:04:34 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Parsing pipe delimited records with embeded newlines
Message-Id: <x7bs1ql1f1.fsf@mail.sysarch.com>


perldoc -f split

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Wed, 05 Feb 2003 19:45:31 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Parsing pipe delimited records with embeded newlines
Message-Id: <3E41B02B.3C97DAB6@earthlink.net>

Will wrote:
> 
> I'm having a problem parsing a flat file with multiple records
> arranged in the following general form (<START OF RECORD> and <END OF
> RECORD> are listed only to facilitate understanding of record
> boundary):

   perldoc -q split
   perldoc -q "more than one line"

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: Thu, 06 Feb 2003 01:06:17 GMT
From: miamspam@vveyron.easynetbox.net (Vincent Veyron)
Subject: Re: PERL + SQL
Message-Id: <3e41b2f4.573300485@news.easynet.fr>

On 5 Feb 2003 02:46:06 -0800, fredduc@hotmail.com (fredduc) wrote:

>Hi all,
>
>
>This is just a newbie question, here it comes:
>
>
>And second question: I use a lot of (shame on me) MS Access databases.
>Is this Perl compatible with MS-SQL? Because I do have too much
>ASP-pages based on MS-SQL and NOT MySQL...
>

Nothing to be ashamed of. 

To connect to an mdb file, you need to create a System DSN in your
ODBC control panel. Then, as already mentionned, you can use DBI to
connect to the data source, and just send the SQL you want to it;

Below is test CGI script that works on a windows machine (sorry for
the bad formatting)




#!Perl
use strict;
use CGI;
use DBI;
my $Client_name;
my $Client_surname;
my $cgiobject;
my $dbh;
my $sqlstatement;
my $sth;
my @row;

	#get the parameters from the form
	#create an instance of the CGI object
	$cgiobject = new CGI;
	#grab the values submitted by the user
	$Client_name=$cgiobject->param("client_name");
	$Client_surname=$cgiobject->param("client_surname");	

		

     #open connection to Access database
     $dbh = DBI->connect("dbi:ODBC:my.mdb","me","passwd");

     #prepare and execute SQL statement
     $sqlstatement="insert into tblClient
(Id_Civilite,Particule,Prenom,Nom) select 1 as expr1, '' as expr2,'".
$Client_surname."' as expr3,'". $Client_name."' as expr4";
	 
	 $sth = $dbh->prepare($sqlstatement);
     $sth->execute || 
           die "Could not execute SQL statement ... maybe invalid?";

	 #output database results
     $sqlstatement="select all * from tblClient where
id_Client=(select max(Id_client) from tblClient)";
		$sth = $dbh->prepare($sqlstatement);
	     $sth->execute ||die "Could not execute SQL statement ...
maybe invalid?";

		print "Content-type:text/html\n\n";
	
		while (@row=$sth->fetchrow_array)
     
	  { print "Vous avez inscrit :
$row[3]".chr(32)."$row[2]".chr(32)."$row[4]".chr(32)."\n"; }


-- 

www.vincentveyron.com



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

Date: Thu, 6 Feb 2003 00:18:16 +0100
From: "TJ" <trond@bwsnett.no>
Subject: Please help a beginner in PEARL and CGI!
Message-Id: <b1s63s$169nuc$1@ID-175630.news.dfncis.de>

Hi.
I'm a very new beginner in scripting. I have a problem when I wan't to write
information from a form in a text file for later use in SSI.

The problem is putting it all in tables. The script won't work for me.

Here's what I wrote. If anyone could help solving this problem, I would be
very happy.!
The words with $ infront of it is the name of the input field in my form.

open (DATABASE, ">> db.txt") ;
print DATABASE "<div align="center">\n" ;
print DATABASE "<table width="69%" border="1">\n" ;
print DATABASE "<tr bgcolor="#FFFF00">\n" ;
print DATABASE "     <td width="31%"><strong>Name:</strong></td>\n" ;
print DATABASE "      <td width="69%">$name</td>\n" ;
print DATABASE "    </tr>\n" ;
print DATABASE "    <tr bgcolor="#FFFF00">\n" ;
print DATABASE "      <td><strong>E-mail:</strong></td>\n" ;
print DATABASE "      <td>$email</a></td>\n" ;
print DATABASE "    </tr>\n" ;
print DATABASE "    <tr bgcolor="#FFFF00">\n" ;
print DATABASE "      <td><strong>Surenames:</strong></td>\n" ;
print DATABASE "      <td>$sn1 $sn2 $sn3 $sn4 $sn5 $sn6 $sn7 $sn8 $sn9
$sn10</td>\n" ;
print DATABASE "    </tr>\n" ;
print DATABASE "    <tr bgcolor="#FFFF00">\n" ;
print DATABASE "      <td><strong>Parishes:</strong></td>\n" ;
print DATABASE "     <td>$par1 $par2 $par3 $par4 $par5 $par6</td>\n" ;
print DATABASE "    </tr>\n" ;
print DATABASE "    <tr bgcolor="#FFFF00">\n" ;
print DATABASE "     <td><strong>Other Informations:</strong></td>\n" ;
print DATABASE "      <td>$addinfo</td>\n" ;
print DATABASE "    </tr>\n" ;
print DATABASE "  </table>\n" ;
print DATABASE "  <br>\n" ;
print DATABASE "  <strong>Registrated</strong>: $datetime\n" ;

close (DATABASE) ;





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

Date: Wed, 05 Feb 2003 15:27:01 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Please help a beginner in PEARL and CGI!
Message-Id: <3E419DC5.4090002@vpservices.com>

TJ wrote:

> Hi.
> I'm a very new beginner in scripting.


No crime in that, we all were once.  One of the first things you might 
want to learn is the name of the language you are learning, it is Perl, 
not PEARL.

> The problem is putting it all in tables. The script won't work for me.


A second thing to learn: the words "won't work for me" do not convey any 
information.  In order to get help, you have to tell us what you 
expected to happen and if that didn't happen what happened instead, 
including any error or warning messages that were generated.

> open (DATABASE, ">> db.txt") ;


Always check the results of system calls like open:

   open(DATABASE, ">>db.txt") or die "Couldn't open [db.txt]: $!";

> print DATABASE "<tr bgcolor="#FFFF00">\n" ;


There's one problem: you have quotes inside quotes so the program will 
have no way to know what you mean.  You either need to escape the inner 
quotes with a backslash, or even better when you are printing a series 
of lines, use what's called a "HERE" document:

   print DATABASE <<END_OF_TEXT;
      <tr bgcolor="#FFFF00">

     <td width="31%"><strong>Name:</strong></td>

       ...
   END_OF_TEXT

Notice that there are no outer quote marks and you don't need the \n 
either since the line breaks in the here text will be preserved.  Just 
make sure that END_OF_TEXT is on a line by itself with no spaces around it.

-- 
Jeff



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

Date: Wed, 05 Feb 2003 23:32:38 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Please help a beginner in PEARL and CGI!
Message-Id: <mbudash-080BE2.15323705022003@typhoon.sonic.net>

In article <b1s63s$169nuc$1@ID-175630.news.dfncis.de>,
 "TJ" <trond@bwsnett.no> wrote:

> Hi.
> I'm a very new beginner in scripting. I have a problem when I wan't to write
> information from a form in a text file for later use in SSI.
> 
> The problem is putting it all in tables. The script won't work for me.
> 
> Here's what I wrote. If anyone could help solving this problem, I would be
> very happy.!
> The words with $ infront of it is the name of the input field in my form.
> 
> open (DATABASE, ">> db.txt") ;
> print DATABASE "<div align="center">\n" ;
> print DATABASE "<table width="69%" border="1">\n" ;
> print DATABASE "<tr bgcolor="#FFFF00">\n" ;
> print DATABASE "     <td width="31%"><strong>Name:</strong></td>\n" ;
> print DATABASE "      <td width="69%">$name</td>\n" ;
> print DATABASE "    </tr>\n" ;
> print DATABASE "    <tr bgcolor="#FFFF00">\n" ;
> print DATABASE "      <td><strong>E-mail:</strong></td>\n" ;
> print DATABASE "      <td>$email</a></td>\n" ;
> print DATABASE "    </tr>\n" ;
> print DATABASE "    <tr bgcolor="#FFFF00">\n" ;
> print DATABASE "      <td><strong>Surenames:</strong></td>\n" ;
> print DATABASE "      <td>$sn1 $sn2 $sn3 $sn4 $sn5 $sn6 $sn7 $sn8 $sn9
> $sn10</td>\n" ;
> print DATABASE "    </tr>\n" ;
> print DATABASE "    <tr bgcolor="#FFFF00">\n" ;
> print DATABASE "      <td><strong>Parishes:</strong></td>\n" ;
> print DATABASE "     <td>$par1 $par2 $par3 $par4 $par5 $par6</td>\n" ;
> print DATABASE "    </tr>\n" ;
> print DATABASE "    <tr bgcolor="#FFFF00">\n" ;
> print DATABASE "     <td><strong>Other Informations:</strong></td>\n" ;
> print DATABASE "      <td>$addinfo</td>\n" ;
> print DATABASE "    </tr>\n" ;
> print DATABASE "  </table>\n" ;
> print DATABASE "  <br>\n" ;
> print DATABASE "  <strong>Registrated</strong>: $datetime\n" ;
> 
> close (DATABASE) ;
> 

clue:

print DATABASE qq{<div align="center">
<-- more html -->
<br>
<strong>Registrated</strong>: $datetime
};

hth-


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

Date: Thu, 6 Feb 2003 00:58:51 +0100
From: "TJ" <trond@bwsnett.no>
Subject: Re: Please help a beginner in PEARL and CGI!
Message-Id: <b1s8fv$16gb1n$1@ID-175630.news.dfncis.de>

Hehe...
Sorry, I'm Norwegian, and I'm also having a little trouble with the
language...
But that does not belong in this cathegory....  :-)

"Jeff Zucker" <jeff@vpservices.com> skrev i melding
news:3E419DC5.4090002@vpservices.com...
> TJ wrote:
>
> > Hi.
> > I'm a very new beginner in scripting.
>
>
> No crime in that, we all were once.  One of the first things you might
> want to learn is the name of the language you are learning, it is Perl,
> not PEARL.
>
> > The problem is putting it all in tables. The script won't work for me.
>
>
> A second thing to learn: the words "won't work for me" do not convey any
> information.  In order to get help, you have to tell us what you
> expected to happen and if that didn't happen what happened instead,
> including any error or warning messages that were generated.
>
> > open (DATABASE, ">> db.txt") ;
>
>
> Always check the results of system calls like open:
>
>    open(DATABASE, ">>db.txt") or die "Couldn't open [db.txt]: $!";
>
> > print DATABASE "<tr bgcolor="#FFFF00">\n" ;
>
>
> There's one problem: you have quotes inside quotes so the program will
> have no way to know what you mean.  You either need to escape the inner
> quotes with a backslash, or even better when you are printing a series
> of lines, use what's called a "HERE" document:
>
>    print DATABASE <<END_OF_TEXT;
>       <tr bgcolor="#FFFF00">
>
>      <td width="31%"><strong>Name:</strong></td>
>
>        ...
>    END_OF_TEXT
>
> Notice that there are no outer quote marks and you don't need the \n
> either since the line breaks in the here text will be preserved.  Just
> make sure that END_OF_TEXT is on a line by itself with no spaces around
it.
>
> --
> Jeff
>




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

Date: Wed, 05 Feb 2003 19:22:12 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Q on Guttman-Rosler
Message-Id: <3E41AAB4.E19E950F@earthlink.net>

kj wrote:
> 
> I want to sort an array of records.  The records are strings
> consisting of tab-delimited fields.  The field I want to sort by
> represents a float (in ASCII).  Furthermore, the first field
> represents the record's (1-based) position in the array.  Therefore,
> after sorting the array, I must update the value of the first field
> in each record.
[snip]

Try this:

   BEGIN {
      8 == length pack 'd'
         or die "Expected double length to be 8";
   }
   use constant BIGENDIAN => pack('N', 1) eq pack('L', 1);
   my $i = 0;
   my @sorted =
      grep substr($_, 0, index($_, "\t", 8)-1, ++$i),
      sort
      map {
         my $n = (split /\t/, $_, 6)[5];
         (BIGENDIAN ?
            pack('d', $n) : reverse pack('d', $n))
            ^ ($n < 0 ? "\xFF" x 8 : "\x80")) . $_
      } @origdata;
   __END__

[untested]

By avoiding subroutine calls, and because the BIGENDIAN ?...:... gets
constant folded so only the code for one of the two branches remains,
this *should* be faster than either of the solutions uri posted.

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: Wed, 05 Feb 2003 23:29:48 GMT
From: "matt" <urzaserra@home.com>
Subject: Script not working correctly
Message-Id: <M7h0a.20262$Xz4.640119@news2.west.cox.net>

Hi,



This is part of an email list signup script I purchased directly from the
author who also installed it onto my host's server. Since he installed it
and has been paid, he no longer responds to my emails to him about a defect
I found in the script. The problem is that although the script works, no
more than one person should be able to signup using a particular "USERID"
but unfortunately any numbers of people can signup using the same "USERID".
Per line 36, there is this statement:



if ($d_userid ne "") { $message .= "The 'User ID' you have chosen is already
on our database.<br>\n"; $found_err++; }



Apparently the author did try to write the code to compare the inputted
value "USERID" to the contents of mySQL database. I am assuming that if
there was a duplicate the user would be asked to try again. Please note the
other checks for duplications such as line 43 and line 51 perform correctly:



if ($ccontact ne "") { $message .= "The 'Contact Email' you have entered is
already on our database.<br>\n"; $found_err++; }



if ($ccontact ne "") { $message .= "The 'Subscribed Email' you have entered
is already on our database.<br>\n"; $found_err++; }



So that if the "Contact Email" or the "Subscribed Email" preexists in the
mySQL database the user would be asked to supply a different email address
for each of these values. These two lines (43 and 51) works as they should.
This is not the case for the "USERID" though.



The script you see here is the complete signup.cgi script. Since I am not a
programmer, I would very much appreciate any ideas as to what's wrong and if
there is an easy fix. Any help or comments would be very much appreciated.

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
require "user-lst.inc";

$| = 1;
print "Content-type: text/html\n"; # Header Left Open here knowingly

use CGI;
$in = new CGI;
$action = $in->param('action');
$new_userid = $in->param('new_userid');
$new_password = $in->param('new_password');
$new_passwordv = $in->param('new_passwordv');
$new_fullname = $in->param('new_fullname');
$new_contact = $in->param('new_contact');
$new_subscribed = $in->param('new_subscribed');
$mtY = $in->param('mtY');
if ($mtY eq "") { $mtY = "FREE"; }
elsif (($mtY ne "FREE")&&($mtY ne "PRO")&&($mtY ne "PLATINUM")) { $mtY =
"FREE"; }

if ($new_userid eq "") { $message .= "The field 'User ID' must be filled in
 ...<br>\n"; $found_err = "9"; }
if ($new_password eq "") { $message .= "The field 'Password' must be filled
in ...<br>\n"; $found_err = "9"; }
if ($new_passwordv ne "$new_password") { $message .= "The passwords entered
do not match ...<br>\n"; $found_err = "9"; }
if ($new_fullname eq "") { $message .= "The field 'Full Name' must be filled
in ...<br>\n"; $found_err = "9"; }
if ($new_contact eq "") { $message .= "The field 'Contact Email' must be
filled in ...<br>\n"; $found_err = "9"; }
if (($new_subscribed eq "")&&($mtY ne "PLATINUM")) { $message .= "The field
'Subscribed Email' must be filled in ...<br>\n"; $found_err = "9"; }
if ($found_err eq "9") { &PrintError($message); exit; }

&OpenMySQL;
$found_err = 0;
$dtable = "$prefix"."_members";
$m_type = "$mtY";
&DoConv;
&GetMemberInfo($new_userid);
if ($d_userid ne "") { $message .= "The 'User ID' you have chosen is already
on our database.<br>\n"; $found_err++; }

$mysql = "SELECT * FROM $dtable WHERE contact='$new_contact'";
$results = $dbh->prepare($mysql);
$results->execute();
$ref = $results->fetchrow_hashref();
$ccontact = $ref->{'contact'};
if ($ccontact ne "") { $message .= "The 'Contact Email' you have entered is
already on our database.<br>\n"; $found_err++; }

if ($new_contact ne "$new_subscribed") {
  $mysql = "SELECT * FROM $dtable WHERE subscribed='$new_subscribed'";
  $results = $dbh->prepare($mysql);
  $results->execute();
  $ref = $results->fetchrow_hashref();
  $ccontact = $ref->{'contact'};
  if ($ccontact ne "") { $message .= "The 'Subscribed Email' you have
entered is already on our database.<br>\n"; $found_err++; }
  }

$mysql = "SELECT * FROM $dtable WHERE subscribed='$new_contact'";
$results = $dbh->prepare($mysql);
$results->execute();
$ref = $results->fetchrow_hashref();
$ccontact = $ref->{'subscribe'};
if ($ccontact ne "") { $message .= "The 'Contact Email' you have entered is
already on our database.<br>\n"; $found_err++; }

if ($new_contact ne "$new_subscribed") {
  $mysql = "SELECT * FROM $dtable WHERE contact='$new_subscribed'";
  $results = $dbh->prepare($mysql);
  $results->execute();
  $ref = $results->fetchrow_hashref();
  $ccontact = $ref->{'subscribe'};
  if ($ccontact ne "") { $message .= "The 'Subscribed Email' you have
entered is already on our database.<br>\n"; $found_err++; }
  }
if ($found_err >= 1) { &CloseMySQL; &PrintError($message); exit; }

if ((($mtY eq "PRO")or($mtY eq "PLATINUM"))&&($safelist_type eq "NORMAL")) {
  require "$data_dir/AffPayOut.pm";
  &PayOutNow; }
if (($mtY ne "")&&($safelist_type eq "POINTS")) {
  require "$data_dir/AffPayOut.pm";
  &PayOutNow; }

if ($mtY eq "PLATINUM") { $dstatus = "VERIFIED"; $status_note = "You can now
login and send your ad to the entire list."; $acode = ""; }
else {
  $dstatus = "UNVERIFIED";
  $status_note = "You must verify your subsribed email address by clicking
on the link sent there ($new_subscribed) before you are able to send your
ads to the list.";
  ($ab,$cd,$ef,$gh) = split(/\./, $ipadd);
  $acode = ((($ab + $ef)*$cd)-$gb)*$sec;
  open (MAIL, "|$mailprog -t");
  print MAIL "To: $fullname <$new_subscribed>\n";
  print MAIL "From: $site_name <$admin_email>\n";
  print MAIL "Subject: Account Activation Link.\n\n";
  print MAIL "In order to activate your $site_name $mtY account just click
on the link below:\n\n";
  print MAIL "$cgi_bin/verify.cgi?$acode \n";
  print MAIL "<a href=\"$cgi_bin/verify.cgi?$acode\">Click here to
re-activate</a> \n\n";
  print MAIL "$site_name\nAdministration\n";
  close (MAIL); }

open (MAIL, "|$mailprog -t");
print MAIL "To: $fullname <$new_subscribed>\n";
print MAIL "From: $site_name <$admin_email>\n";
print MAIL "Subject: Your New $mtY Safelist Account.\n\n";
print MAIL "Hi $new_fullname\n\n";
if ($mtY ne "FREE") { print MAIL "Thank you for your order.\n\n"; }
print MAIL "Your new safelist account at the $site_name was\n";
print MAIL "successfully created.\n\n";
print MAIL "Below is your login information along with the login url:\n\n";
print MAIL "Login URL:\n";
print MAIL "$login_url\n\n";
print MAIL "User ID: $new_userid\n";
print MAIL "Password: $new_password\n\n";
print MAIL "Save and/or Print this email for your records.\n\n\n";
print MAIL "$admin_name\n";
print MAIL "Webmaster\n";
print MAIL "$site_name\n";
close (MAIL);

if ($notify_paid eq "ON") {
  open (MAIL, "|$mailprog -t");
  print MAIL "To: $admin_name <$admin_email>\n";
  print MAIL "From: $site_name <$bounced_email>\n";
  print MAIL "Subject: New \"Paid\" Member Notification\n\n";
  print MAIL "New $mtY Member Information:\n\n";
  print MAIL "User ID: $new_userid\n";
  print MAIL "Subscribed Email: $new_subscribed\n";
  print MAIL "Contact Email: $new_contact\n";
  print MAIL "IP Address: $ENV{'REMOTE_ADDR'}\n";
  print MAIL "Name: $new_fullname\n";
  print MAIL "Type: $mtY\n\n";
  print MAIL "For more information on this member visit your Administrative
Section.";
  close (MAIL); }

$dtable = "$prefix"."_members";
$sql = "INSERT INTO $dtable (userid, password, fullname, contact,
subscribed, type, joindate, ipaddress, status, vacation, bounces, points,
notes, extra1, extra2, extra3) VALUES
('$new_userid','$new_password','$new_fullname','$new_contact','$new_subscrib
ed','$mtY','$todays_date','$ipadd','$dstatus','OFF|','0','$points_join','','
$acode','','')";
$dbh->do($sql);
$dtable = "$prefix"."_alinks";
$sql = "INSERT INTO $dtable (userid, linkssent, clicks, earnings,
paidearnings, resetdate, extra1, extra2, extra3) VALUES
('$new_userid','0','0','0','0','$todays_date','','','')";
$dbh->do($sql);
$dtable = "$prefix"."_affiliates";
$sql = "INSERT INTO $dtable (userid, clicks, referrals, earnings,
paidearnings, resetdate, extra1, extra2, extra3) VALUES
('$new_userid','0','0','0','0','$todays_date','','','')";
$dbh->do($sql);
&CloseMySQL;

open (NEWCFILE, ">$data_dir/codes/$new_userid.idb");
print NEWCFILE "";
close (NEWCFILE);
if ($opsystem eq "UNIX") { $mde = 0777; chmod ($mde,
"$data_dir/codes/$new_userid.idb"); }
open (NEWAFILE, ">$data_dir/alinks/$new_userid.idb");
print NEWAFILE "";
close (NEWAFILE);
if ($opsystem eq "UNIX") { $mde = 0777; chmod ($mde,
"$data_dir/alinks/$new_userid.idb"); }

print "\n";
$section = "New Member Signup - Account Created";
require "$data_dir/html_head.inc";
print <<ACCOUNTMADE;
<div align="center">
<p><b>Your $mtY account has been created successfully.</b></p>
<p>$status_note</p>
<p>Your login information has been sent to your contact email address
($new_contact).</p>
<p>Click on the button below to Login automatically to the members section
with your new account.</p>
<form method="POST" action="$cgi_bin/login.cgi"><p><input type="submit"
value="Login ($new_userid)" class="form-button"></p><input type="hidden"
name="userid" value="$new_userid"><input type="hidden" name="password"
value="$new_password"></form>
</div>
ACCOUNTMADE
require "$data_dir/html_foot.inc";
exit;




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

Date: Thu, 06 Feb 2003 00:03:36 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Script not working correctly
Message-Id: <x7fzr2l1go.fsf@mail.sysarch.com>


whatever it cost, you paid too much.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Thu, 06 Feb 2003 00:10:12 GMT
From: "Erik Allen" <newsemail@erikallen.com>
Subject: Re: Some confusion
Message-Id: <EJh0a.1616$1q2.145314@newsread2.prod.itd.earthlink.net>

Smiley:
also, keep in mind that as an independent, you are most likely going to be
bidding on projects.  There are factors there that can make your hourly wage
increase/decrease dramatically over what you actually "charge".

example:  I charge X dollars an hour.  I figure a project will take me 20
hours, so I bid it at 20x.  Getting into the project, I realize I have code
libraries to handle most of the project, and it ends up taking me 10 hrs.  I
have just cut my time in half, so my rate just doubled!  I make 2x / hr.

same project gets submitted to the client, and they have a ton of changes
that technically fall into the scope of the project (also need to be careful
about your procedures and policies about change orders and "out of scope"
work).  no the project ends up taking 40hrs.  I am now taking twice as long,
on the same bottom line, so only making 1/2x /hr.

So moral of the story, everyone probably has a story or two where they were
making chump change per hour to get a project done.  But the important thing
is to learn how to forsee those "speed bumps" and plan accordinglt, both in
contracts, and in your bidding analysis.

-Erik


"Smiley" <smiley@uvgotemail.com> wrote in message
news:v42k6nki9dnm55@corp.supernews.com...
>
> "Jim Davis" <newsmonkey@vboston.com> wrote in message
> news:b1rdhc012ng@enews1.newsguy.com...
> >
> > In addition, due to the burst, there are a LOT of orphaned technologies
> out
> > there.  Tools like Tango, Lasso, WebPlus, SilverStream, etc all got used
> by
> > somebody, somewhere.  Now these companies are finding it nigh-impossible
> to
> > find people qualified to work on this systems.   This leaves two holes
> open:
> > one for people that actually do now these systems, and another for
people
> > able to convert them to newer, better supported systems.
> >
> > There's at least some contracting work out there for this as my last few
> > inquires have been of this nature.
>
> Great information Jim, thanks.  Can you confirm or deny, though, whether
> there are programmers out there making minimum wage?  Or does the very low
> end still pay higher than minimum wage?
>
>
>




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

Date: Wed, 05 Feb 2003 19:32:50 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Some embedded Perl (ala libperl.a) questions...
Message-Id: <3E41AD32.E07EEE78@earthlink.net>

Asfand yar Qazi wrote:
> 
> I am using embedded Perl inside a game I'm developing (love that
> Class::Classless...)
> 
> I currently evaluate perl expressions inside a 'temporary' package to
> avoid namespace pollution.  Which is good.  Problem is that when I
> evaluate 'exit', my program exits!  How do I stop this behaviour?

Either define a sub CORE::GLOBAL::exit, and make sure that your *actual*
exit is called as CORE::exit, or define an exit sub in your temporary
package, else use Safe.pm and evaluate the code inside a safe
compartment which has the exit opcode disabled.

Where are these perl expressions coming from, anyway?

> Also, how can I clean out the symbol table of a package after it has
> been used?

   use Symbol qw(delete_package);

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: Wed, 05 Feb 2003 19:17:57 -0500
From: istink <istink@real.bad.com>
Subject: Re: sort, my concoction of
Message-Id: <3E41A9B5.DA3209E1@real.bad.com>

very good answers. thanks.
I need to let it all sink in.


-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
   http://www.newsfeed.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----


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

Date: Wed, 05 Feb 2003 17:37:23 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: string in datei (but starting to drift OT)
Message-Id: <87wukel2oc.fsf_-_@limey.hpcc.uh.edu>

>> On Wed, 5 Feb 2003 20:48:35 +0100,
>> "Alan J. Flavell" <flavell@mail.cern.ch> said:

> On Feb 5, Jan Engelhardt inscribed on the eternal
> scroll:

> (Datei) previously contained, or not.

> (und wegen "datei", hat man inzwischen Grossschreiben
> aufgegeben?)

Some people think it's time to drop the capitalisation.
Some written dialects often do (e.g. weanerisch).

> Executive summary: we don't know the questioner's
> present level of expertise very clearly, we don't know
> very clearly what they want to achieve and in what
> context; so I think it's taking a risk to guess what
> they want and offer one specific answer (which itself
> was incomplete by the generally accepted guidelines of
> this group).

Although it's generally assumed that a group with a
non-locale prefix is going to use English (Merkunish :-)
as its medium, this isn't going to happen all the time.
Non-English posts in clpm for example are pretty rare
though aren't they?

My take on it is that if someone posts in a language other
than English, then there's going to be someone else who
knows that language *and* English who can (a) gently
indicate that English is preferred here, (b) mention a
language-specific similar group, and (c) translate (and
maybe answer) the question for everyone else, or at least
open it up for all...

hth
t


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

Date: 05 Feb 2003 23:20:05 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: string in datei
Message-Id: <slrnb43714.9nr.abigail@alexandra.abigail.nl>

Tassilo v. Parseval (tassilo.parseval@post.rwth-aachen.de) wrote on
MMMCDXLV September MCMXCIII in <URL:news:b1s41j$d13$1@nets3.rz.RWTH-Aachen.DE>:
''  Also sprach Abigail:
''  
'' > Huh? This isn't en.comp.lang.perl.misc.  It would be unfair to ban
'' > people to a regional group just because they don't master English.
'' > I speak a different language than English. Should I monitor other
'' > Perl groups as well (and hence have less time to answer questions
'' > here), or are you implying that people who don't master English 
'' > have no right to hear my opinion about their questions?
''  
''  I sense a slight contradiction here. Someone not mastering English
''  is probably only interested in your opinion if this opinion is brought
''  forth in his mother tongue. Otherwise it wont be of so much use to him.

I fail to see the contradiction here. As I said, English is not the 
only language I master. 



Abigail
-- 
$=-=4*++$|;{print$"x--$==>"\@\x7Fy~*kde~box*Zoxf*Bkiaox \r"
                            ^
$/x24if!select$,,$,,$,,join+q=.==>$^W=>$|;$=&&redo}sleep$|;


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 4518
***************************************


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