[8012] in Perl-Users-Digest
Perl-Users Digest, Issue: 1637 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 14 12:07:46 1998
Date: Wed, 14 Jan 98 09:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 14 Jan 1998 Volume: 8 Number: 1637
Today's topics:
***Perl/Internet Developers Needed -FLORIDA <jmorris@silcoinc.com>
[Fwd: Fork in a CGI] <ruben@wynn.com>
Re: bulk mail <Jacqui.Caren@ig.co.uk>
Re: Clever way to trash a bunch of global variables? (Andrew M. Langmead)
Re: Create file <barnett@houston.Geco-Prakla.slb.com>
Re: Displaying GIFs - oops <jdporter@min.net>
elegant way to compare two arrays <TobiasBugala@swol.de>
getting charecters from a variable <mat.r@ukonline.co.uk>
Re: getting charecters from a variable (Mike Stok)
Re: getting charecters from a variable <Y_Hu@fccc.edu>
Help Removing Spaces <hashema@icd.teradyne.com>
Re: Help Removing Spaces (Mike Stok)
Re: Help Removing Spaces <dboorstein@ixl.com>
Re: Help Removing Spaces <Y_Hu@fccc.edu>
Help with my code please <Webmaster@builders-connection.com>
Re: Module Net::FTP problems <BC3-AU@bigfoot.com>
opening text file <Webmaster@builders-connection.com>
Re: Perl not Y2K compliant <Jacqui.Caren@ig.co.uk>
pod2html bug + fix (Ken)
Re: Problems installing perl5.004_01 on HPUX10.20 (David Hawkins)
Query on Uncaught Exception <simon@century.demon.co.uk>
Re: recomended Perl books ? <jdporter@min.net>
Re: Script hangs after download <juan@vibrant.com>
Sorting a textfile <fge@elsamprojekt.dk>
Re: Sorting a textfile (Nathan V. Patwardhan)
Re: source into binary code <dboorstein@ixl.com>
the -> operator <prl2@lehigh.edu>
Re: the -> operator (Brian Wheeler)
Re: unlink () doesn't work under NT <BC3-AU@bigfoot.com>
use diagnostics; <prl2@lehigh.edu>
Would this code be right <Webmaster@builders-connection.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Jan 98 15:08:08 GMT
From: "Jim L. Morris" <jmorris@silcoinc.com>
Subject: ***Perl/Internet Developers Needed -FLORIDA
Message-Id: <01bd20fe$b5694900$2bf58bd0@ws03.silcoinc.com>
If this is the wrong place to post this message then I
apologize. I posted the same message yesterday I
thought and it was erased. I'll give it one more shot.
Please e-mail me if this is a "No No" place to post
these job openings.
One of our clients based in Boca Raton, Florida
has several openings for Junior, Mid, and Senior Level
Internet/Perl Developers. Positions are permanent
and include good salary plus benefits with a rapidly expanding
company involved in Leading Edge Internet Technology
(Perl, CGI, Java, ASP, IIS, Front Page, etc...)
In May this company had 40 employees and has grown to
120 employees since that time!!!!!! Outstanding opportunities exist.
Come to Florida and enjoy warm weather
year around, a low cost of living, some of the best
beaches in the U.S., and no State Income Tax!!!!!!!!!!!
Due to the immediate needs of our client we cannot consider
H-1 visa candidates at this time. No 3rd party calls please.
For more info. contact: (Prefer E-mail)
Jim Morris
SILCO Software Technology, Inc.
jmorris@silcoinc.com
888-745-2646 ext. 11(toll free)
813-939-0703 (Fax)
------------------------------
Date: Wed, 14 Jan 1998 10:01:58 +0000
From: Ruben <ruben@wynn.com>
Subject: [Fwd: Fork in a CGI]
Message-Id: <34BC8D16.4DADBB3F@wynn.com>
This is a multi-part message in MIME format.
--------------F7ECDAEAEAE3143315F83278
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
--------------F7ECDAEAEAE3143315F83278
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-ID: <34BC8B94.AED68AB3@wynn.com>
Date: Wed, 14 Jan 1998 09:55:32 +0000
From: Ruben <ruben@wynn.com>
X-Mailer: Mozilla 4.04 [en] (X11; I; Linux 2.0.30 i586)
MIME-Version: 1.0
To: Richard Caley <rjc@liddell.cstr.ed.ac.uk>
Subject: Re: Fork in a CGI
References: <34BC28C1.F730B7F1@wynn.com> <eyh3eirgza2.fsf@liddell.cstr.ed.ac.uk>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Thanks Richard. I thought it mght be the case that the buffers are
involved. But it is unual that the repeating output starts with the
file headers - the very beginning of the file, and at the same stop
repeatedly.
Can this be do to how apache handles the STDOUT. Even if it does. I'm
still confused about the mechanism of this problem. My forked process
has no outup (yet). Why would it create any output trouble at all.
Thanks
Ruben
http://www.brooklynonline.com
--------------F7ECDAEAEAE3143315F83278--
------------------------------
Date: Wed, 14 Jan 1998 11:20:46 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: bulk mail
Message-Id: <EMru6n.1Fu@ig.co.uk>
In article <34AB0BD0.1BB1@arrowweb.com>, Mike <mhanson@arrowweb.com> wrote:
>If i am writing a program to send bulk email, is using sleep 1 enough
>time to make it so that i don't overload the sendmail program?
If a bulk email has 5000 recipients then why do you need to sleep
if you are only delivering one message. I hope you are not delivering
a message per recipient. That is not bulk email that is pain!
Also asking your local MTA to route is simply not cost-effective.
Use a perl script than will route you message directly via your ISP's
mailgate via SMTP.
I wrote a small proglet that takes around 5000 email messages with a
total of around 200,000 recips and delivers the mail. It does the whole
lot in around 30 minutes via SMTP to a ISP gateway. Because the
mailgate used had MX validation enabled, invalid domains were reported
at SMTP submit time and could be marked as invalid in the database for
the next run.
So, there are some valid purposes for the generation and delivery of
bulk email. And in the above case, it is actually good for the internet,
as 5K mails splitting through the internet are a lower traffic overhead
than 200,000+ mails with many duplicates.
Jacqui
FYI: The project involved delivering job search results to many
(registered) people in a combinatorial fashion - people who ask for the
same info get the same email. This (at a large enough scale) cuts down
of network traffic at for the customer, ISP and internet in general.
p.s.
Many MTA's with MX routing will split on MX dest rather than recipient
domain. This means that all us folks at *.demon.co.uk sites should get
shared (unsplit) messages delivered even though some addresses (such as
ig.co.uk) do not have demon.co.uk in the address.
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Wed, 14 Jan 1998 15:45:59 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Clever way to trash a bunch of global variables?
Message-Id: <EMs6Gn.Cp3@world.std.com>
Dean Pentcheff <dean@tbone.biol.sc.edu> writes:
>I've briefly explored putting the whole thing into a subroutine within
>a package, thinking that if I did a $obj = packagename->new() on
>each invocation of the program, the global variables (now within the
>package namespace) would be refreshed each time. Of course, that
>doesn't work - global variables within a package persist for the life
>of the program.
>Any better ideas? Thanks!
How about using the Safe module (with as permissive opcode mask as you
want to give it) and running the code in there? Then the package is
relative to the Safe compartment. A new Safe object for each
invocation would be a new namespace.
--
Andrew Langmead
------------------------------
Date: Wed, 14 Jan 1998 08:48:21 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Create file
Message-Id: <34BCD035.665794A9@houston.Geco-Prakla.slb.com>
Kitse / Phoenix Bird Coders wrote:
>
> Hiya,
>
> I didn't find out, how could one create file in perl.
> Ok, one way is open(SomeHandle,">SomeFile"); --- that's not working (and
Okay. What error are you getting? I suspect you are getting an error
back from the OS that might be very helpful. Also, standard practice is
to use ALL CAPS for FILEHANDLES.
Whenever you open a file, you should test the return code. It could
prove very useful. Try this, and get back to us:
open(SOMEHANDLE, ">$FileNameVariable") or die "Cannot access file:
$!\n";
The above will attempt to open the file specified by $FileNameVariable
on filehandle SOMEHANDLE. If successful, you will be able to
write/print to SOMEHANDLE. If unsuccessful, the script will print out
something like "Cannot access file: Permission Denied". The important
part there is "Permission Denied".
HTH.
> man says that) when filename is in some variable, say,
> open(SomeHandle,">$FileNameVariable"); # <- not OK
>
(should be.....something else is wrong)
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Wed, 14 Jan 1998 09:56:31 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Displaying GIFs - oops
Message-Id: <34BCD21F.64D8@min.net>
You definitely should undef $/ so that <IMAGE> gets the entire image
data blob at once.
Also, you might try setting binmode(STDOUT).
Also, after you've read the image data into $gif_image,
you can get the number of bytes (content length) by simply
calling length($gif_image), rather than doing the stat.
Don't forget, you can't send html content and image content
in the same response!
hth,
John Porter
------------------------------
Date: Wed, 14 Jan 1998 15:54:33 +0100
From: Tobias Bugala <TobiasBugala@swol.de>
Subject: elegant way to compare two arrays
Message-Id: <34BCD1A9.1D13@swol.de>
Hi,
what would be the most elegant way to compare two different arrays?
if (@arrayone == @arraytwo) {..}
doesn't work...
while (($arrayone[$i] == $arraytwo[$1]) && ($arrayone[$i] != "")) {
i++;
}
would no be to elegant....
do you know a better way?
TOBI
------------------------------
Date: 14 Jan 1998 15:15:28 GMT
From: "Matthew Robertson" <mat.r@ukonline.co.uk>
Subject: getting charecters from a variable
Message-Id: <01bd20fe$f094af60$1201010a@tipsytoad.ukonline.co.uk>
Hi
I am try to get the first six charecters from a variable and store them in
seperate variables, or seperate array elements.
e.g. Variable = Matthew
var1 = M
..
var6 = e
I am trying to use substr at the moment, but I am getting some strange
results.
Please can anyoe help.
Thanks in advance
Mat
------------------------------
Date: 14 Jan 1998 10:58:12 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: getting charecters from a variable
Message-Id: <69inak$10h$1@stok.co.uk>
In article <01bd20fe$f094af60$1201010a@tipsytoad.ukonline.co.uk>,
Matthew Robertson <mat.r@ukonline.co.uk> wrote:
>Hi
>
>I am try to get the first six charecters from a variable and store them in
>seperate variables, or seperate array elements.
>
>e.g. Variable = Matthew
>var1 = M
>..
>var6 = e
>
>I am trying to use substr at the moment, but I am getting some strange
>results.
You can use split to split a string into characters (bytes) and then toss
away any excess e.g.
@letters = split //, $variable;
splice @letters, 6;
This is perl, there's more than one way to do it...
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 14 Jan 1998 11:05:03 -0500
From: Ying Hu <Y_Hu@fccc.edu>
Subject: Re: getting charecters from a variable
Message-Id: <34BCE22F.41C6@fccc.edu>
> e.g. Variable = Matthew
> var1 = M
> ..
> var6 = e
>
> I am trying to use substr at the moment, but I am getting some strange
> results.
>
> Please can anyoe help.
>
> Thanks in advance
>
> Mat
How about:
$Variable = "Matthew";
for ($i=0; $i<length $Variable; $i++){
$var[$i] = substr($Variable,$i,1);
}
Ying
------------------------------
Date: Wed, 14 Jan 1998 10:18:08 -0500
From: Abdo Hashem <hashema@icd.teradyne.com>
Subject: Help Removing Spaces
Message-Id: <34BCD730.3372@icd.teradyne.com>
I am working on a program that accepts information from the operator
and am setting up input masks for valid input.
How do I remove any leading AND trailing whitespace on the strings
entered??
Thanks in Advance
------------------------------
Date: 14 Jan 1998 10:39:35 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Help Removing Spaces
Message-Id: <69im7n$tj$1@stok.co.uk>
In article <34BCD730.3372@icd.teradyne.com>,
Abdo Hashem <hashema@icd.teradyne.com> wrote:
>I am working on a program that accepts information from the operator
>and am setting up input masks for valid input.
>
>How do I remove any leading AND trailing whitespace on the strings
>entered??
If you have a recent perl then you should have the perfaq documentation
installed, and the man or perldoc command can be used to access it.
Section 4 of the faq (perlfaq4) includes:
How do I strip blank space from the beginning/end of a
string?
The simplest approach, albeit not the fastest, is probably
like this:
$string =~ s/^\s*(.*?)\s*$/$1/;
It would be faster to do this in two steps:
$string =~ s/^\s+//;
$string =~ s/\s+$//;
Or more nicely written as:
for ($string) {
s/^\s+//;
s/\s+$//;
}
Personally I prefer the last two approaches even though thay aren't one
liners (and I'd disagree about the one liner being simplest, as I think
about future maintainers a bit...)
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 14 Jan 1998 11:10:48 -0500
From: Dan Boorstein <dboorstein@ixl.com>
Subject: Re: Help Removing Spaces
Message-Id: <34BCE388.B70D838A@ixl.com>
Mike Stok wrote:
>
> In article <34BCD730.3372@icd.teradyne.com>,
> Abdo Hashem <hashema@icd.teradyne.com> wrote:
> >I am working on a program that accepts information from the operator
> >and am setting up input masks for valid input.
> >
> >How do I remove any leading AND trailing whitespace on the strings
> >entered??
>
> If you have a recent perl then you should have the perfaq documentation
> installed, and the man or perldoc command can be used to access it.
> Section 4 of the faq (perlfaq4) includes:
>
> How do I strip blank space from the beginning/end of a
> string?
>
> The simplest approach, albeit not the fastest, is probably
> like this:
>
> $string =~ s/^\s*(.*?)\s*$/$1/;
>
> It would be faster to do this in two steps:
>
> $string =~ s/^\s+//;
> $string =~ s/\s+$//;
>
i believe these can be combined into the following one liner:
$string =~ s/^\s+|\s+$//g;
i would also guess that it is faster than the one liner in the faq.
dan
------------------------------
Date: Wed, 14 Jan 1998 11:13:12 -0500
From: Ying Hu <Y_Hu@fccc.edu>
Subject: Re: Help Removing Spaces
Message-Id: <34BCE418.167E@fccc.edu>
Abdo Hashem wrote:
>
> I am working on a program that accepts information from the operator
> and am setting up input masks for valid input.
>
> How do I remove any leading AND trailing whitespace on the strings
> entered??
>
> Thanks in Advance
I am not sure that following is right or the best.
$string = " asd fgh jkl ";
$string =~ s/^\s+//g;
$string =~ s/\s+$//g;
Ying
------------------------------
Date: Tue, 13 Jan 1998 07:16:14 -0700
From: Builders Connection <Webmaster@builders-connection.com>
Subject: Help with my code please
Message-Id: <34BB772E.6934@builders-connection.com>
#!/user/bin/perl
# Program to do the obvious
#checking for any comma's
#Can I combined the substitute statement and have it chek for both at
one time
$sitename =~ s/,//;
$type =~ s/,//;
$name =~ s/,//;
$address1 =~ s/,//;
$city =~ s/,//;
$state =~ s/,//;
$zip_code =~ s/,//;
$country =~ s/,//;
$phone =~ s/,//;
$phone2 =~ s/,//;
$e_mail =~ s/,//;
#checking for any \n
$sitename =~ s/\n//;
$type =~ s/\n//;
$name =~ s/\n//;
$address1 =~ s/\n//;
$city =~ s/\n//;
$state =~ s/\n//;
$zip_code =~ s/\n//;
$country =~ s/\n//;
$phone =~ s/\n//;
$phone2 =~ s/\n//;
$e_mail =~ s/\n//;
open(FILE, ">> builders.txt")|| die "I can't open: Database\n";
print FILE
"$sitename,$type,$name,$address1,$city,$state,$zip_code,$country,$phone,$phone2,$e_mail
\n"; #Print a message
close(FILE);
--
=================================================
Hope you like your e-mail!
This is from Jim's wonderful box of replies!
Remember to write back: <Jim39@interworldnet.net>
=================================================
Or visit my site at:
<http://www.builders-connection.com>
------------------------------
Date: 14 Jan 1998 23:49:15 -0800
From: Bruce Cook <BC3-AU@bigfoot.com>
Subject: Re: Module Net::FTP problems
Message-Id: <ud8hutbwk.fsf@donal.kintailrd>
schinder@leprss.gsfc.nasa.gov (Paul J. Schinder) writes:
> } use Net::FTP;
> }
> } $ftp = Net::FTP->net($mail_machine);
>
> $ftp = Net::FTP->new($mail_machine);
>
Groan! My fingers have been pre-programmed
I don't beleive I didn't see that.
Thanks.
--
...BRU
Bruce Cook, Synonet Corp. E-Mail: bc3-au@bigfoot.com
Phone: +61 15 999 330 Fax: +61 8 9227 7390
------------------------------
Date: Mon, 12 Jan 1998 17:41:50 -0700
From: Builders Connection <Webmaster@builders-connection.com>
Subject: opening text file
Message-Id: <34BAB84D.3972@builders-connection.com>
How can I have perl open a text file that is a comma delimited database
file and then check to see if the name is there and if so not add the
entree? I already have a form and a database scripted put together but
I can't figure out how to do this checking. If I can just be pointed
the right I'm sure I can figure it out I hope.
Thank you
James Barber
------------------------------
Date: Wed, 14 Jan 1998 11:32:22 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Perl not Y2K compliant
Message-Id: <EMrupz.1IF@ig.co.uk>
In article <pudge-0501980901290001@ppp-9.ts-1.kin.idt.net>,
Chris Nandor <pudge@pobox.com> wrote:
>In article <68hppo$99g@flatland.dimensional.com>, mfuhr@dimensional.com
>(Michael Fuhr) wrote:
>
>perl -le 'print scalar localtime 2**32'
>Mon Feb 6 06:28:15 2040
>
>
>Hm. I retire (turn 65) in July 2038. If I am using Macs, then I can
>retire before the problem hits. Score one for Apple. ;-)
As long as your pension fund is managed on a mac - otherwise you may find
your pension fund "dissapears" with many others :-)
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Wed, 14 Jan 1998 11:10:45 -0500
From: ken@forum.swarthmore.edu (Ken)
Subject: pod2html bug + fix
Message-Id: <ken-1401981110450001@news.swarthmore.edu>
Hi-
I found that the pod2html I have (the one that came with 5.004_04) was
producing some garbled output. Specifically, the first paragraph after a
=head2 item would show up on the same line as the =head2. I made a slight
modification to pod2html:
Old line 390:
print HTML "$text\n<P>\n\n";
New line 390:
print HTML "<P>$text\n</P>\n\n";
This does the trick for me.
Thoughts? Tom, should this go in as a permanent change?
-Ken Williams
The Math Forum
ken@forum.swarthmore.edu
------------------------------
Date: 14 Jan 1998 06:54:35 -0800
From: dhawk@best.com (David Hawkins)
Subject: Re: Problems installing perl5.004_01 on HPUX10.20
Message-Id: <69ijjb$spb$1@shell3.ba.best.com>
Hmm, I used HP's ANSI C compiler on HPUX 10.01 and then tar'd that
up and installed it on my HPUX 10.20 machines and it worked just fine.
Just another option if you have an 10.01 machine.
Another thing to check is that you've got the latest patches from HP
for the C compiler and the OS. They're always updating their patch
list on their web site. I know I've got three different patches for
the C compiler installed on the 10.01 machine.
later, david
--
David Hawkins dhawk@best.com http://www.river.org/~dhawk
"America is a stronger nation for the ACLU's uncompromising effort."
-- President John F. Kennedy
------------------------------
Date: Wed, 14 Jan 1998 15:23:38 +0000
From: Simon Peate <simon@century.demon.co.uk>
Subject: Query on Uncaught Exception
Message-Id: <MUTaiXA6hNv0EAQj@century.demon.co.uk>
I am receiving the following when no parameters are supplied to my perl
script:
Uncaught exception from user code:
No parameter supplied!
The start of my script is as follows:
#!/opt/perl/bin/perl -w
use strict;
use diagnostics;
die "No parameter supplied!\n" unless $ARGV[0];
Why is it uncaught when I thought I'd caught it?
--
Simon Peate
------------------------------
Date: Wed, 14 Jan 1998 10:03:22 -0500
From: John Porter <jdporter@min.net>
Subject: Re: recomended Perl books ?
Message-Id: <34BCD3BA.4ADF@min.net>
Piers Cawley wrote:
>
> If a `religion' is defined to be a system of ideas that contains
> unprovable statements, then Godel taught us that mathematics is not
> only a religion, it is the only religion that can prove itself to be
> one. -- John Barrow
Depends on what Barrow meant by "mathematics". In fact, part of Godel's
proof is that the number of incomplete logical systems is infinite.
So Barrow is right only if by "mathematics" he means all logical
systems that share the incompleteness property.
John Porter
------------------------------
Date: 14 Jan 1998 15:37:55 GMT
From: "Juan Vega" <juan@vibrant.com>
Subject: Re: Script hangs after download
Message-Id: <01bd2101$968f4ea0$4b3d61c7@hercules.vibrant>
To Whoever gives a d*mn <g>,
I found fix that works very well:
print "Content-type: text/html\n\n"; # tells client that following code is
HTML
print "<META HTTP-EQUIV=\"Refresh\"
CONTENT=\"1;URL=http://www.vibrant.com/download/files/sebeta7.exe\">\n";
} else
{
print "Content-type: text/html\n\n"; # tells client that following code
is HTML
print "<META HTTP-EQUIV=\"Refresh\"
CONTENT=\"1;URL=http://www.vibrant.com/download/noagmt.htm\">\n";
exit;
}
The file then finishes its business and prints out a final html page.
- Juan
_____________________
Juan Vega <juan@vibrant.com> wrote in article
<01bd206f$3f3f1780$4b3d61c7@hercules.vibrant>...
> # 2) is coded as follows and works fine, too. That is, the file is
> recognized by the browser and begins to download.
>
> if ($in{'license_agreement'} =~ /^yes\b/i)
> {
> print "Location: ../download/files/sebeta7.exe \n"; #
> $in{'requested_prod'}";
> } else
> {
> print "Location: ../download/noagmt.htm \n";
> exit;
> }
>
> # 3), 4), and 5), however do not seem execute and my error logs do
not
> indicate any malfunctions on the server side so syntax, etc. is fine
>
> I'll be happy to provide source if needed but I think I may have just
> abused PERL a little more than it allows. Once I sent the browser to the
> new "Location: ....." it just stopped paying attention to the script,
> didn't it?
------------------------------
Date: Wed, 14 Jan 1998 16:47:46 +0100
From: Franziskus Geeb <fge@elsamprojekt.dk>
Subject: Sorting a textfile
Message-Id: <34BCDE22.3D93@elsamprojekt.dk>
Hi everybody,
a newbie-question :-)
I want to sort a textfile on a number, which is on position "two" in
this ::-sperated textfile:
xxxxx::number_here::xxxx::xxxxx:: ...
My idea was to put the textfile in an array with the number in the first
position; like:
number_here::xxxxxxx::xxxx::...
That works fine, but sorting the array causes problems in the sortorder
which ended like 1 13 2 25 3 4 5 etc.
Any help/suggestions?
Thanks
Franziskus
fge@elsamprojekt.dk
------------------------------
Date: 14 Jan 1998 15:55:36 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Sorting a textfile
Message-Id: <69in5o$j1a@fridge.shore.net>
Franziskus Geeb (fge@elsamprojekt.dk) wrote:
: I want to sort a textfile on a number, which is on position "two" in
: this ::-sperated textfile:
: xxxxx::number_here::xxxx::xxxxx:: ...
What does perlfaq4 tell you?
Use the Schwartz(ian transform)!
from perlfaq4:
@sorted = map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, uc((/\d+\s*(\S+)/ )[0] ] } @data;
Given the file:
ora:books:500:techie
something:something else:1:other
nate:foobar:300:test
him:his:100:male
her:hers:3:female
cat:meow:5:little friskies
other:other:999:ouch
You could do something like:
#!/usr/local/bin/perl -w
use strict;
my(@data, @sorted);
@data = <>;
@sorted = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_, (split(/:/, $_))[2] ] } @data;
for(@sorted) { print; }
--
Nathan V. Patwardhan
please don't spam UnFriend@stop-harassing-the-public.com?
------------------------------
Date: Wed, 14 Jan 1998 10:07:29 -0500
From: Dan Boorstein <dboorstein@ixl.com>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: source into binary code
Message-Id: <34BCD4B1.833924F3@ixl.com>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> :Hi, I would like to know how to turn the perl source code
> :into binary/executable code due to security.
>
> Compiling produces no security. Read the FAQ.
>
i have to disagree with this statement. i can't read compiled
code just by opening a file. in order to understand just
what's going on internally i would have to disassemble the code.
as it just so happens, i don't know how to do that. so, if
the original poster can compile his code, it keeps me from
exploiting his mistakes through explicit knowledge of what they
are. instead i would have to make assumptions about "typical"
mistakes. that sounds like added security to me. furthermore,
i'd bet that there are a lot of others like me.
sure, it's no absolute, but most security (computers and otherwise),
is simply the act of adding more or taller "hurdles". putting
a flood light outside my house doesn't stop someone from breaking
in but it might make them think twice, and try the neighbors house
instead.
thank you for your time,
dan
------------------------------
Date: 14 Jan 1998 15:21:45 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: the -> operator
Message-Id: <01bd2100$20a45880$3e03b480@mm>
Someone just showed me that
$dbh = DBI->connect($datasource, $user, $pass) or whatever;
actually passes 4 values into sub connect's @_, namely:
$class, $datasource, $user, and $pass.
Why? What is going on that the class is being passed? Is it because of
the -> notation as opposed to plain old function(params) notation?
TIA
--
Phil R Lawrence
Systems and Networking Development Services
Programmer/Analyst
prl2@lehigh.edu
------------------------------
Date: 14 Jan 1998 16:12:36 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: the -> operator
Message-Id: <69io5k$kpd$1@flotsam.uits.indiana.edu>
In article <01bd2100$20a45880$3e03b480@mm>,
"Phil R Lawrence" <prl2@lehigh.edu> writes:
> Someone just showed me that
> $dbh = DBI->connect($datasource, $user, $pass) or whatever;
>
> actually passes 4 values into sub connect's @_, namely:
> $class, $datasource, $user, and $pass.
>
> Why? What is going on that the class is being passed? Is it because of
> the -> notation as opposed to plain old function(params) notation?
yes. the -> will pass whatever's on the left of the ->. It has to
be either a class name or a blessed reference.
Brian
------------------------------
Date: 15 Jan 1998 00:16:51 -0800
From: Bruce Cook <BC3-AU@bigfoot.com>
Subject: Re: unlink () doesn't work under NT
Message-Id: <ubtxetamk.fsf@donal.kintailrd>
Koos Pol <koos_pol@bigfoot.com> writes:
> > unlink ("$jukebox[$i]\\$date\\*") || warn ("cannot delete files\n");
>
> Try
> unlink ("$jukebox[$i]\\$date\\*") || warn ("cannot delete files$!\n");
>
> This should produce a diagnostic. BTW, unlink works on my NT 3.51
> install.
An interesting aside tot his is that "$jukebox[$i]/$date/*" is valid also
on the NT machine, and will remove some of the confusion with '\' in the
name. (Also makes the script portable)
--
...BRU
Bruce Cook, Synonet Corp. E-Mail: bc3-au@bigfoot.com
Phone: +61 15 999 330 Fax: +61 8 9227 7390
------------------------------
Date: 14 Jan 1998 15:49:13 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: use diagnostics;
Message-Id: <01bd2103$f6b94f40$3e03b480@mm>
I say:
#!/usr/local/bin/perl -w
use diagnostics;
use strict;
and get useful stuff. However, sometimes that stuff is pretty verbose, and
runs past 80 (or 132) characters and I can't read it. Is there any way to
text wrap the diagnostic output, of pipe it to a file?
--
Phil R Lawrence
Systems and Networking Development Services
Programmer/Analyst
prl2@lehigh.edu
------------------------------
Date: Mon, 12 Jan 1998 16:48:33 -0700
From: Builders Connection <Webmaster@builders-connection.com>
Subject: Would this code be right
Message-Id: <34BAABD1.7805@builders-connection.com>
#!/user/bin/perl
# Program to do the obvious
#
$hello = "Hello, World";
$Goodbye = "Goodbye, World";
@H = "$hello,$Goodbye";
$hello =~ s/,//;
$Goodbye =~ s/,//;
$hello =~ s/\n//;
$Goodbye =~ s/\n//;
open(FILE, ">> hello.txt")|| die "I can't open: Database\n";
print FILE "$hello,$Goodbye \n"; #Print a message
close(FILE);
print "@H";
------------------------------
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 1637
**************************************