[13706] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1116 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 19 11:07:51 1999

Date: Tue, 19 Oct 1999 08:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940345518-v9-i1116@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 19 Oct 1999     Volume: 9 Number: 1116

Today's topics:
    Re: %hash array problem (Tad McClellan)
    Re: 'use FileHandle' fails if indirectly referenced fro <andrew.mclaren@swx.ch>
    Re: A question on Perl/Tk <sjoseph7@worldnet.att.net>
        A simple question about Mail::Send <jphil@act.oda.fr>
        Can't get Perl working with Apache <kevin.porter@fast.no>
    Re: Can't get Perl working with Apache <kperrier@blkbox.com>
        CGI, netBIOS, nbtstat <ei99waka@chl.chalmers.se>
    Re: Decoding mime attchs (jpg) in email (Martien Verbruggen)
    Re: eBay <NukeEmUp@ThePentagon.com>
    Re: eBay <gellyfish@gellyfish.com>
    Re: help with substrings <gainuae1@emirates.net.ae>
    Re: help with substrings <gellyfish@gellyfish.com>
    Re: How to print password by "crypt" ? <hmaster@factory.co.kr>
    Re: How to write isdigit() in Perl (Tad McClellan)
    Re: in the array or not? <sariq@texas.net>
        MacPerl scripts in the background <lee333@earthlink.net>
    Re: need cgi script lowdogg@my-deja.com
    Re: newbie <jtribbeck@argogroup.com>
    Re: One bug with local and one bug with perlbug (Anno Siegel)
    Re: OT: Din paper sizes (was Re: PDFlib size settings) <isaac.hepworth@dresdner-bank.com>
        OT: Newsreader? a.k.a Re: Ignore the idiots <camerond@mail.uca.edu>
    Re: OT: Newsreader? a.k.a Re: Ignore the idiots <gellyfish@gellyfish.com>
    Re: PerlScript for ASP installation problem <rootbeer@redcat.com>
    Re: PerlScript for ASP installation problem <devx@hotmail.com>
        Problem with Solaris install <Adrian.Davis@lewisham.gov.uk>
        Pseudo Hashes <scott@salmon.ltd.uk>
    Re: Q: Truncate string length? <bivey@teamdev.com>
    Re: regexp-problem (Anno Siegel)
    Re: shifting a hash <aqumsieh@matrox.com>
    Re: Splitting a long line with irregular spaces <wyzelli@yahoo.com>
    Re: Unix command =?iso-8859-1?Q?=B4tree=B4?= in Perl? <jboes@qtm.net>
    Re: Unix command =?ISO-8859-1?Q?=B4tree=B4?= in Perl? <gellyfish@gellyfish.com>
    Re: what is SHTML ? c_j_marshall@hotmail.com
    Re: WHATS WRONG WITH THIS CODE? <camerond@mail.uca.edu>
    Re: WHATS WRONG WITH THIS CODE? <pollayil20@yahoo.com>
    Re: WHATS WRONG WITH THIS CODE? <sariq@texas.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 19 Oct 1999 05:31:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: %hash array problem
Message-Id: <7pdhu7.22c.ln@magna.metronet.com>

Marc (kwantm@convertis.nl) wrote:

: Very nice try to confuse me but I have solved the problem on my own.
: foreach (keys %mydata)
  ^^^^^^^
  ^^^^^^^
: { print "$_ = $mydata{$_}\n";  }

: this is the proper solution.

: Abigail <abigail@delanet.com> wrote in message

: > Look up the description of foreach, and you'll be enlightned.
                               ^^^^^^^
                               ^^^^^^^

   So Abigail pointed you to the proper solution.

   Once again the clueless get the right answer and bitch about it!


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 19 Oct 1999 14:00:59 GMT
From: aml <andrew.mclaren@swx.ch>
Subject: Re: 'use FileHandle' fails if indirectly referenced from a setuid script
Message-Id: <7uhtii$b0r$1@nnrp1.deja.com>

Thanks for the notes. I wasn't aware of cgiwrap, so am having a look at
this at present. It's not that clean needing a separate script for each
user (sounds like the ongoing maintenance holes I try and avoid!), but
it may work. On the suEXEC side, we use Netscape servers, and have only
heard references to this in an Apache context. Does Netscape have an
equivalent? (not really a Perl question I know!)

On the setuid perl, I can find no signs of an sperl or suidperl on our
systems (it's not my installation, so don't know much of the history).
From looking at the config, it appears to have been built using the
SETUID_SCRIPTS_ARE_SECURE_NOW option. Is the setuid emulator still
installed in this case?

--
Andrew McLaren
Swiss Stock Exchange


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 19 Oct 1999 07:36:48 -0700
From: Santosh Joseph <sjoseph7@worldnet.att.net>
Subject: Re: A question on Perl/Tk
Message-Id: <380C8200.4F5A1C8F@worldnet.att.net>

Try the $widget->after(millisec,callback) function...


PS: this question should be posted to comp.lang.perl.tk


Lishan Song wrote:

> Could anyone help me out of the problem?
> In my Perl/Tk script, I want to do something periodically (let's
> say every 1 minute). But the MainLoop call will just sit in its
> internal loop. I know this MainLoop waits  for events, eg, button.
> But is there a method for this call to work with sleep() so that
> after sleep, I can do something?
>
> Thanks



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

Date: 19 Oct 1999 15:29:20 +0200
From: J-P Theberge <jphil@act.oda.fr>
Subject: A simple question about Mail::Send
Message-Id: <87904zfphr.fsf@godzilla.oda.fr>

Hi,

With Mail::Send, how can I change the From field?

Thanks!

--
JP Theberge
jphil@act.oda.fr


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

Date: Tue, 19 Oct 1999 13:59:36 +0100
From: kev <kevin.porter@fast.no>
Subject: Can't get Perl working with Apache
Message-Id: <380C6B37.B4AE5CD3@fast.no>

Hi,

I hope someone here can tell me what I'm doing wrong. I'm trying to
configure Apache (on Linux) to run Perl CGI scripts. All I get at the
moment is a "Internal server error" error in the browser when I try to
run a Perl script from cgi-bin. The 'test-cgi' file (shell script) which
came with Apache 1.3.9 does not produce an error.

I have also tried addingan AddHandler file like:

AddHandler cgi-script cgi pl

to my httpd.conf file, but that makes no difference. What am I doing
wrong?

thanks,

- Kev



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

Date: 19 Oct 1999 09:41:31 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Can't get Perl working with Apache
Message-Id: <639D8844CEEAE096.02639D248DA95EB4.2B7CE1600C502B0F@lp.airnews.net>

kev <kevin.porter@fast.no> writes:

> Hi,
> 
> I hope someone here can tell me what I'm doing wrong. I'm trying to
> configure Apache (on Linux) to run Perl CGI scripts. All I get at the
> moment is a "Internal server error" error in the browser when I try to
> run a Perl script from cgi-bin. The 'test-cgi' file (shell script) which
> came with Apache 1.3.9 does not produce an error.
> 
> I have also tried addingan AddHandler file like:
> 
> AddHandler cgi-script cgi pl
> 
> to my httpd.conf file, but that makes no difference. What am I doing
> wrong?

From what you describe, it sounds like you don't have the server configured
correctly.  Look at the documentation that should have come with the source
distribution of apache.

A peek at the error log would probably provide a clue to the problem as well.

Kent
-- 
Expect to be publicly mocked as long as you call yourselves "perl experts".

	- Abigail in slrn7qbcr6.r33.abigail@alexandra.delanet.com


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

Date: Tue, 19 Oct 1999 15:40:35 +0200
From: Karl =?iso-8859-1?Q?W=E4gander?= <ei99waka@chl.chalmers.se>
Subject: CGI, netBIOS, nbtstat
Message-Id: <380C74D3.A2FFC4B6@chl.chalmers.se>

Is there a way to use perl to get the same information as the
nbtstat-command? I´d like to use it for a page so that i can welcome my
visitors with their usernames... Thanks on advance!

// Karl - ei99waka@chl.chalmers.se


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

Date: 19 Oct 1999 12:38:43 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Decoding mime attchs (jpg) in email
Message-Id: <slrn80opj3.1vv.mgjv@wobbie.heliotrope.home>

On Tue, 19 Oct 1999 04:45:16 -0700,
	AF778 <af778NOafSPAM@iname.com.invalid> wrote:
> I was searching for it in cpan with no luck until now, i found no clear
> code or maybe i'm looking bad.
> I need to decode an e-mail (residing in a PLAIN TEXT FILE, in the
> Apache server /mail directory) with mime encoded JPG attachs in it.
> I need a perl code to read the plain text file and when i find the mime
> section, decode it and save it as a JPG file in some directory.

How well did you look?
back to CPAN:

http://www.cpan.org/

[modules]

[The Module List]

[15) World Wide Web, HTML, HTTP, CGI, MIME]
<page down>

Oooh.. Look! MIME::Base64, and MIME::QuotedPrint, and MIME::Decoder and
 ...

[Back]

[19) Mail and Usenet News]

Ooooh, look, Mail::Header, and Mail::Internet, and Mail::Util and
Mail::Field and ...

Hard to believe that between the 20 or so modules mentioning Mail:: and
MIME:: there isn't a thing that you can use?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | What's another word for Thesaurus?
NSW, Australia                  | 


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

Date: Tue, 19 Oct 1999 13:54:12 +0100
From: David Cantrell <NukeEmUp@ThePentagon.com>
Subject: Re: eBay
Message-Id: <OGcMOPHym8Ee6lzkSQDX6hoqNDm4@4ax.com>

On Tue, 19 Oct 1999 07:54:52 -0400, "Corey Martin" <nospam@nospam.com>
said:

>Is it possible to receive a certain auction's current selling price from
>eBay (without buying Anaconda for $120) in Perl?  If so, what code do I use?

You can 'roll yer own' script to do this simple task.  You should use
LWP::Simple.  You may also want to use a module for parsing the
resulting pages, although personally I wouldn't bother for such a
simple task.

It shouldn't take more than ten minutes to write this script.

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: 19 Oct 1999 13:57:52 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: eBay
Message-Id: <380c6ad0_1@newsread3.dircon.co.uk>

Corey Martin <nospam@nospam.com> wrote:
> Is it possible to receive a certain auction's current selling price from
> eBay (without buying Anaconda for $120) in Perl?  If so, what code do I use?
> 

If it is possible you will almost certainly using the module LWP::UserAgent


#!/usr/bin/perl -w

use strict;

use LWP::UserAgent;

$|++;

my $ua = new LWP::UserAgent;

$ua->agent("Gellzilla/666");

my $url = 'http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=178605262';

my $req = new HTTP::Request 'GET',$url;

my $res = $ua->request($req);
print $res->status_line,"\n";
print $res->content;


Of course how you get the selling price out of that is left as an exercise.

/J\
-- 
"The internet is like a car boot sale" - Jon Sopel, BBC News


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

Date: Tue, 19 Oct 1999 16:33:35 +0400
From: Anand Sunny <gainuae1@emirates.net.ae>
Subject: Re: help with substrings
Message-Id: <380C651F.35BC8ED6@yahoo.com>

Check the spelling substr - You had written subst also see that the scalar
is within the quotes.

APS

Kevin Monroe wrote:

> For some reason this relatively easy problem has been stumping me all
> day.  Any help would be appreciated as I am beginning to lose my mind
>
> I have a comma deliminated text file such as
>
> 121,Jimmy,Jones,0,1,21,555,89
> 1547,James,Johnson,155,87,6,1,301
> 14,Me,Again,12,197,0,22,1
>
> and so on
> all Im trying to do is get say the first and the third fields after the
> comma
> I have tried to split it over and over again but no matter what I try I
> get "use of uninitialized valued at line"
>
> here is the code albeit very simple
>
> #!/usr/local/bin/perl -w
>
> open(NEW, "< /path/to/file.txt") or die "Can't open file.txt: $!";
>
> @data = <NEW>;
>
> foreach $element(@data){
>    split(/,/, $line);
>    print $element;
> }
>
> close <NEW>;
>
> What I would like to be able to do here is get the say 1st,3rd and 5th
> entries following the comma.  However $data[0] reveals the first full
> line commas and all.  And since the length of each field varies using
> subst($line,0,1) will not work either
>
> any ideas???



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

Date: 19 Oct 1999 14:01:09 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: help with substrings
Message-Id: <380c6b95_1@newsread3.dircon.co.uk>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> 
> foreach $row (@data)
>   {
>     @fields = split /,/,$line;
                          ^^^^^

Make that $row of course ...
                          
/J\
-- 
"Shhh! They're strapping down Liza Minelli" - Lisa Simpson


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

Date: Tue, 19 Oct 1999 21:42:01 +0900
From: "Yeong Mo/Director Hana co." <hmaster@factory.co.kr>
Subject: Re: How to print password by "crypt" ?
Message-Id: <6PJXt2iG$GA.131@news.thrunet.com>

Thank you for your well made script.
I tried it, and it works good.

Will you please give me more advice ?

I have my own script.
There are already certain ID and passwd like follows;
$ID = "aaa"
$password = "bbb"

So, I only need to print ID and password in .htpasswd file something like
ID:32FaNzLNPWjoM.

I guess the following lines are the key.
Am I right ?

$hash{$user} = crypt($FORM{new}, $salt)

if (open(OUT, ">$file")) {
  flock(OUT,2);
  print OUT "$ID:$hash{$name}";
close OUT;
}

Thank you in advance....
David Efflandt ÀÌ(°¡) ¸Þ½ÃÁö¿¡¼­ ÀÛ¼ºÇÏ¿´½À´Ï´Ù...
>On Tue, 19 Oct 1999 12:05:13 +0900, Yeong Mo/Director Hana co.
><hmaster@factory.co.kr> wrote:
>>
>>I'm trying to make  .htpasswd and .htaccess files through webbrowser.
>>
>>.htaccess can be made by cgi script as "print file..."
>>That's I can do.
>>
>>Now, I have problem to print .htpasswd.
>>Since I have tried to make password file using "crypt", I meet errors.
>>
>>Would someone please help me how to print this file.
>
>http://www.xnet.com/~efflandt/pub/htpasswd.pl
>
>--
>David Efflandt  efflandt@xnet.com  http://www.xnet.com/~efflandt/
>http://www.de-srv.com/  http://cgi-help.virtualave.net/
>http://thunder.prohosting.com/~cv-elgin/




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

Date: Tue, 19 Oct 1999 05:27:40 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to write isdigit() in Perl
Message-Id: <cidhu7.22c.ln@magna.metronet.com>

Govindaraj (umungo01@shafika.vetri.com) wrote:

: I am matching the Page Number, which is in two different formats
: as described below:

: Page: 44
: Page: xxiii

: I want to convert the above two lines in two different way.  How can I
: differentiate the Arabic Numberal Page Number with the Roman Page Number.


   if ( /^Page: \d+$/ )
      { print "Arabic\n" }
   else
      { print "not Arabic\n" }

: More preciously, I am just like for a function 


   Oh.

   I can't help there.

   My approach uses the match operator, but no functions. Sorry.


: which will test my
: pattern whether it's numeric or string.


   You cannot "test a pattern".

   You can test whether or not a string matches a pattern though.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 19 Oct 1999 09:50:02 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: in the array or not?
Message-Id: <380C851A.4D21E7CC@texas.net>

Joe Zelwietro wrote:
> 

<snipped large section of code>

I haven't commented on the 'snipped' code, since Jeff has already given
you plenty of good advice.

Just a couple of other comments, though.

> # @allCeckouts prints out 423
> # Where does the 423 come from?
> 
> print OUTPUT @allCheckouts." hi there\n";

You are accessing the array in scalar context.  See the docs for more
info.

> 
> close (INPUT);
> close (OUTPUT);

You should check the success of your close(s).

- Tom


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

Date: Tue, 19 Oct 1999 08:20:03 -0400
From: Lee Phillips <lee333@earthlink.net>
Subject: MacPerl scripts in the background
Message-Id: <191019990820032460%lee333@earthlink.net>

When I have a MacPerl script running in the background, even just
sleeping, the response of the machine slows down. Is there way to cure
this, or to package the script as an application so that it can behave
as other applications, that wait quietly in the background without
affecting system performance?



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

Date: Tue, 19 Oct 1999 12:13:11 GMT
From: lowdogg@my-deja.com
Subject: Re: need cgi script
Message-Id: <7uhn8g$6b9$1@nnrp1.deja.com>

In article <Pine.BSF.4.05.9910181608250.23904-100000@monet.bestweb.net>,
  Mike Salter <msalter@bestweb.net> wrote:
>
>
> On Mon, 18 Oct 1999, T. Wilson wrote:
>
> TW>Willing to pay for:
> TW>
> TW>I need a simple autoresponder as follows:
> TW>
> TW>1. the user fills out an online form
> TW>2. the form data is sent to a specified email address
> TW>3. the user recieves a confirmation email
> TW>
>
> Go to Yahoo and search on formmail, as this is the standard script as
I
> recall for doing this sort of thing.  If the author doesn't charge for
it,
> send him a donation or something.
>
> Mike
>
>
I will do this job Under my companys name http://www.webcarpentry.com
send us an e-mial at info@webcarpentry.com to get more details
estimated cost would be about 30-50 dollars


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 19 Oct 1999 16:46:36 +0100
From: Jason P Tribbeck <jtribbeck@argogroup.com>
Subject: Re: newbie
Message-Id: <380C925C.58039DC7@argogroup.com>

Ran Shoham wrote:
> 
> Hi there, I'm a Perl newbie.
> 
> I'm trying to figure out how to extract information from a file that I
> have already existing.
> 
> The file consists of lines of the following format:
> 
> <someword>: <number_of_files> <filename1.txt> <filename1.txt> ....
> 
> I want to do something like the following:
> 
> while ($line = <FILE>) {
>    ($word, $number, $array_of_files) = split(" ", $line);
> 
> 
> but how would I get the array_of_files to work?
> I can't figure that out.

Change it to:

($word, $number, @array_of_files) = split(" ", $line);

And while you're at it, change your signature - it's too long...

-- 
Jason Tribbeck                                     Argo Interactive ltd
Senior Design Engineer                        7 Dukes Court, Chichester
                                                  West Sussex, PO19 2FX
Tel: +44 1243 815 815 Fax: +44 1243 815 805                     England


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

Date: 19 Oct 1999 12:49:54 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: One bug with local and one bug with perlbug
Message-Id: <7uhpdi$kbl$1@lublin.zrz.tu-berlin.de>

Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:
>
>perlbug seems to be broken right now (or the mail system behind it
>is). so just mail the bug (and it seems to be one to me) directly to

Likewise, the information collected by study() is lost after an
intervening local().  This is perhaps not entirely surprising.

Anno


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

Date: Tue, 19 Oct 1999 13:29:55 +0100
From: "Isaac Hepworth" <isaac.hepworth@dresdner-bank.com>
Subject: Re: OT: Din paper sizes (was Re: PDFlib size settings)
Message-Id: <7uho2e$jgo20@ln1p0207inf.dresdnerkb.com>

Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote in message
news:slrn80ndil.r9t.sholden@pgrad.cs.usyd.edu.au...
> I found it funny that someone could say that there is a ratio which is
> 'exactly' 1:sqrt(2). Since the whole idea of irrational numbers is that
> they can not be expressed as ratios.

Is it also funny that the ratio between the diameter of a circle and its
circumference is exactly pi? The whole idea of irrational numbers is that
they can't be expressed as ratios of *rational* numbers. There's nothing to
say that they can't arise out of geometry or geometrical ratios---and many
do.





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

Date: Tue, 19 Oct 1999 07:44:09 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: OT: Newsreader? a.k.a Re: Ignore the idiots
Message-Id: <380C6799.562B2A9A@mail.uca.edu>

[cc'd to mv, just in case he doesn't read my post]

Martien Verbruggen wrote:
> 
> [original question snipped]
> 
> Get some good newsreading software that can do article scoring. Score
> some people positively, others negatively. Kill others totally. Set up
> a list of subjects to kill or score negatively. Sort by score.
> 
> About 75% of the posts in this group reach my screen. The bottom half of
> those almost never get read by me.
> 
> Since I started doing that, my clpm experience has improved a lot. It
> was definitely worth the change of news reader.

OK, you've got my curiosity piqued. What newsreader do you use?

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: 19 Oct 1999 14:00:06 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: OT: Newsreader? a.k.a Re: Ignore the idiots
Message-Id: <380c6b56_1@newsread3.dircon.co.uk>

Cameron Dorey <camerond@mail.uca.edu> wrote:
> [cc'd to mv, just in case he doesn't read my post]
> 
> Martien Verbruggen wrote:
>> 
>> [original question snipped]
>> 
>> Since I started doing that, my clpm experience has improved a lot. It
>> was definitely worth the change of news reader.
> 
> OK, you've got my curiosity piqued. What newsreader do you use?
> 

slrn apparently ...

/J\
-- 
"Mark my words, sex is never enough. Sooner of later she'll want a
dishwasher" - Policeman, City Central


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

Date: Tue, 19 Oct 1999 06:14:45 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: PerlScript for ASP installation problem
Message-Id: <Pine.GSO.4.10.9910190613590.19476-100000@user2.teleport.com>

On Tue, 19 Oct 1999, DeveloperX wrote:

> The scripts are fine, there is no problem with them as they run on a
> PWS server with PerlScript already installed. It is a problem with the
> server, perhaps that there should be more installation steps
> necessary. Does anyone have any ideas?

You're probably right: It's not a problem with the scripts; it's a problem
with the server. Perhaps you should search for a newsgroup about servers
and related issues. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 19 Oct 1999 15:53:36 +0100
From: "DeveloperX" <devx@hotmail.com>
Subject: Re: PerlScript for ASP installation problem
Message-Id: <7ui0jm$l5i$1@starburst.uk.insnet.net>

To be fair,

I suspect that it's an installation problem, and I suspect that there are
quite a few Perl users who have installed PerlScript as well, and possibly
come across the problem before,

-Tony




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

Date: Tue, 19 Oct 1999 15:54:24 +0100
From: "Adrian Davis" <Adrian.Davis@lewisham.gov.uk>
Subject: Problem with Solaris install
Message-Id: <7ui0kc$l5n$1@starburst.uk.insnet.net>

I've just installed Perl from the "pkgadd" format distribution from
www.sunfreeware.com. When I try to run perl I get the following:-

"ld.so.1: perl: fatal: libcrypt_i.so.1: open failed: No such file or
directory"

I've checked with find, and a I can confirm that no file with this name
exists on my machine (Ultra 5S/Solaris 2.6).

Can anybody help?

Many Thanks,
   =Adrian=





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

Date: Tue, 19 Oct 1999 13:35:27 +0100
From: "Scott Pritchett" <scott@salmon.ltd.uk>
Subject: Pseudo Hashes
Message-Id: <7uhois$1ee$1@lure.pipex.net>

Can anyone show me an example of a pseudo hash, I heard about them on the
Topaz talk on Perl.com but seem unable to get them to work. It seems that an
element of the array should be accessable by accessing it thru the reference
to the hash of field name/indices, but how?


My test code is :-

$hx={'beer'  =>  1, 'snack' =>  2, 'logs'  =>  3, 'last'  =>  4};
@ar=(\%hx, qw( crisps nuts balls beer crap ));
print $ar    something or other;

Scott




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

Date: 19 Oct 1999 14:54:19 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: Q: Truncate string length?
Message-Id: <01bf1a42$078b5a00$3527e1ce@bill.jump.net>

   cberry@cinenet.net (Craig Berry) wrote:
[...]
>   match         => sub {
>                      $_ = $sample;
>                      ($_) = m/(.{0,500})/;
>                    }
> });
>
> __END__
>
> Benchmark: timing 10000 iterations of match, substitute, substr_lv,
> substr_rv...
>      match:  5 secs ( 4.99 usr  0.00 sys =  4.99 cpu)
> substitute: 12 secs ( 6.23 usr  0.00 sys =  6.23 cpu)
>  substr_lv:  3 secs ( 2.51 usr  0.00 sys =  2.51 cpu)
>  substr_rv:  3 secs ( 2.52 usr  0.00 sys =  2.52 cpu)

Couldn't resist trying this myself. On my Pentium using
ActiveState Perl build 519 that last style gave the best
results. (I had to increase iterations to 100,000 to get
reliable timings.)

     match:  2 wallclock secs ( 3.46 usr +  0.00 sys =  3.46 CPU)
substitute:  5 wallclock secs ( 4.33 usr +  0.00 sys =  4.33 CPU)
 substr_lv:  2 wallclock secs ( 1.64 usr +  0.00 sys =  1.64 CPU)
 substr_rv:  2 wallclock secs ( 1.55 usr +  0.00 sys =  1.55 CPU)



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

Date: 19 Oct 1999 13:10:04 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: regexp-problem
Message-Id: <7uhqjc$ke3$1@lublin.zrz.tu-berlin.de>

Andreas Vierengel  <andreas@vierengel.de> wrote in comp.lang.perl.misc:
>My own solution was:
>
>$string  = '123a45678aaa8990a98';
>@matched = $string =~ /(a[^a]+?)(?=a)/cgos; 
>print "@matched\n";
>
>prints:
>a45678 a8990
>
>=> ok
>
>but this is not giving me the non-matches. I need matches AND non-matches in
>separate arrays :-(

You may want to split() the string on your regex.  Since you already
have parenthesis, this will return an alternating list of non-matches
(what the split would return in any case) and matches (the delimiters
split returns when the pattern contains parens).

Anno


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

Date: Tue, 19 Oct 1999 08:55:37 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: shifting a hash
Message-Id: <x3ypuybbjcn.fsf@tigre.matrox.com>


[for some reason Kragen's message didn't make it to my newsfeed]

Uri Guttman <uri@sysarch.com> writes:

> >>>>> "KS" == Kragen Sitaker <kragen@dnaco.net> writes:
> 
>   KS> According to Larry and Uri's paper, reverse sort @x is faster than sort
>   KS> {$b cmp $a} @x for large @x, by a factor of two or three, I think.

That's interesting, but certainly counter-intuitive. I would assume
that the default sort would actually insert a { $a cmp $b } block and
then do the sort. In this case, I don't see any reason why this should
be any faster that specifying { $b cmp $a } as your sort() block. But
I don't know enough of perlguts to conclude for sure, and it seems
logical to optimize this case to do a C strcmp() rather than resort to
calling the Perl block.

But, my benchmarks (on 5.005_03) proved that indeed a 

	sort { $b cmp $a} @a

is faster than

	reverse sort @a;

The benchmark is attached below. I am sure I am doing something wrong
with it. Please correct me if you figure it out.

> this advantage may go away in 5.6. i gather from p5p that a simple
> numeric sort will be optimized to not do any perl callbacks to the block
> but do an internal c compare. i don't know if it will handle the
> reversed $a/$b but it should.

Interesting.

>   KS> Larry and/or Uri can probably post how you could optimize the above
>   KS> sort for speed using pack and substr.
> 
> there are ways to make the a packed integers sort in reverse order. the
> one we propose is to is to xor the bytes of the integer with 0xFF.
> 
> but remember, optimizing sorts is not something you should care about
> unless you have profiled you program and found the sorts eat up too much
> cpu. premature optimization is not cool.

Agreed.

--Ala


Here's the benchmark:

Benchmark: timing 10000 iterations of by_flipping_ab, by_reverse, overhead...
by_flipping_ab: 19 wallclock secs (18.59 usr +  0.00 sys = 18.59 CPU)
by_reverse: 22 wallclock secs (21.10 usr +  0.00 sys = 21.10 CPU)
  overhead: 12 wallclock secs ( 9.69 usr +  0.00 sys =  9.69 CPU)

#!perl -w
use strict;
use Benchmark;

srand;

sub fisher_yates_shuffle {
    my $array = shift;
    my $i;
    for ($i = @$array; --$i; ) {
        my $j = int rand ($i+1);
        next if $i == $j;
        @$array[$i,$j] = @$array[$j,$i];
    }
}

sub overhead {
	my @a = ('a' .. 'z', 'aa .. az');
	fisher_yates_shuffle(\@a);
}

sub by_flipping_ab {
	my @a = ('a' .. 'z', 'aa' .. 'az');
	fisher_yates_shuffle(\@a);
	sort { $b cmp $a } @a;
}

sub by_reverse {
	my @a = ('a' .. 'z',  'aa' .. 'az');
	fisher_yates_shuffle(\@a);
	reverse sort @a;
}

timethese(10000, {
	'overhead'       => \&overhead,
	'by_flipping_ab' => \&by_flipping_ab,
	'by_reverse'     => \&by_reverse,
});



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

Date: Tue, 19 Oct 1999 22:20:27 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Splitting a long line with irregular spaces
Message-Id: <nOZO3.11$mZ1.624@vic.nntp.telstra.net>

Jason P Tribbeck <jtribbeck@argogroup.com> wrote in message
news:380C537C.1320C376@argogroup.com...
> Wyzelli wrote:
> >
> > I need to split the following line into variables, based on the spaces.
> > Unfortunately there is are not an equal number of spaces between the
> > components.  Any ideas of a simple way to get this done?
>
> <snip>
>
> > I have tried a few variations of split() but none work quite right.
>
> Why not try using a regex instead of split - something like:
>
> while($line=~m/((\S+)\s*)/g) {
> print pos($line)-length($1)." -> $2\n";
> }
>
> The print statement shows the position in the string, and $2 is the
> word.
>
> --
> Jason Tribbeck                                     Argo Interactive ltd
> Senior Design Engineer                        7 Dukes Court, Chichester
>                                                   West Sussex, PO19 2FX
> Tel: +44 1243 815 815 Fax: +44 1243 815 805                     England

Just enough info to send me delving into 'substr' which gives me what I
need!
A solution and a learning experience! :-)

Thanks!

Wyzelli




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

Date: Tue, 19 Oct 1999 14:41:51 GMT
From: Jeff Boes <jboes@qtm.net>
Subject: Re: Unix command =?iso-8859-1?Q?=B4tree=B4?= in Perl?
Message-Id: <7uhvvc$crb$1@nnrp1.deja.com>

In article <slrn80nb19.nbs.sholden@pgrad.cs.usyd.edu.au>,
  sholden@cs.usyd.edu.au wrote:
> On Mon, 18 Oct 1999 20:51:35 -0200,
> 	Daniel Apolinario <970493@dcc.unicamp.br> wrote:
> >    I would like to know if anybody knows how to implement the unix
> >command ´tree´ in PERL language.

Well, there's always

#/usr/local/bin/perl
 print `tree @ARGV`;

Or you could visit this page and plagiarize:

http://language.perl.com/ppt/

but they don't have 'tree' on their list.

>
> Did an 'implement a unix command in perl' assignment just approach
the due date
> or something?
>
> --
> Sam
>

Ha! They're all coming from 'unicamp.br'... That must be it... I
suppose we need a Perl bot script to scan all posts from .edu domains...

One wonders about such assignments in the world today where anything
simple is probably available for download from a web page somewhere...
I taught programming classes at a college for a year (almost 20 years
ago!), when such plagiarism wasn't really possible. I dunno what I'd do
today.

--
Jeff Boes  jboes@qtm.net
http://www.qtm.net/~jboes/


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 19 Oct 1999 15:59:15 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Unix command =?ISO-8859-1?Q?=B4tree=B4?= in Perl?
Message-Id: <380c8743_2@newsread3.dircon.co.uk>

Jeff Boes <jboes@qtm.net> wrote:
> In article <slrn80nb19.nbs.sholden@pgrad.cs.usyd.edu.au>,
>   sholden@cs.usyd.edu.au wrote:
>> On Mon, 18 Oct 1999 20:51:35 -0200,
>> 	Daniel Apolinario <970493@dcc.unicamp.br> wrote:
>> >    I would like to know if anybody knows how to implement the unix
>> >command ´tree´ in PERL language.
> 
>>
>> Did an 'implement a unix command in perl' assignment just approach the 
>> due date or something?
>>
> 
> Ha! They're all coming from 'unicamp.br'... That must be it... I
> suppose we need a Perl bot script to scan all posts from .edu domains...
> 

But the ever so more slightly clever ones use a deja news account and make
up some back story if it should be required....

/J\
-- 
"Mark my words, sex is never enough. Sooner of later she'll want a
dishwasher" - Policeman, City Central


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

Date: Tue, 19 Oct 1999 13:15:20 GMT
From: c_j_marshall@hotmail.com
Subject: Re: what is SHTML ?
Message-Id: <7uhqst$8uk$1@nnrp1.deja.com>

In article <380BF886.71538C91@shinbiro.com>,
  Ally Kwon <ewha95@shinbiro.com> wrote:
> i know what HTML is, but what is SHTML ?
> how is it different from HTML ?
>

 ...must restrain flame of death...no...urge too strong...its no
good...here it comes...

#######
   #     #    #     #     ####
   #     #    #     #    #
   #     ######     #     ####
   #     #    #     #         #
   #     #    #     #    #    #
   #     #    #     #     ####


    #     ####
    #    #
    #     ####
    #         #
    #    #    #
    #     ####


 #    #   ####    #####
 ##   #  #    #     #
 # #  #  #    #     #
 #  # #  #    #     #
 #   ##  #    #     #
 #    #   ####      #


   ##
  #  #
 #    #
 ######
 #    #
 #    #


 #####   ######  #####   #
 #    #  #       #    #  #
 #    #  #####   #    #  #
 #####   #       #####   #
 #       #       #   #   #
 #       ######  #    #  ######


  ####   #    #  ######   ####    #####     #     ####   #    #
 #    #  #    #  #       #          #       #    #    #  ##   #
 #    #  #    #  #####    ####      #       #    #    #  # #  #
 #  # #  #    #  #            #     #       #    #    #  #  # #
 #   #   #    #  #       #    #     #       #    #    #  #   ##
  ### #   ####   ######   ####      #       #     ####   #    #


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 19 Oct 1999 07:39:08 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: WHATS WRONG WITH THIS CODE?
Message-Id: <380C666C.61BF8FBF@mail.uca.edu>

Jim wrote:
> 
> #!/usr/bin/perl
> 
> print "Content-Type: text/html\n\n";
> print "<HTML><HEAD>\n";
> print "<TITLE>CGI Test</TITLE>\n";
> print "</HEAD>\n";
> print "<BODY><A HREF=\"http://someplace.com\">Click Here</A>\n";
> print "</BODY></HTML>";
> 
> It gives me a 500 error. All I want to know is if there are any errors in
> this code. thanks
> Jim

Likely only one: perlfaq9

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Tue, 19 Oct 1999 16:47:38 +0400
From: APS <pollayil20@yahoo.com>
Subject: Re: WHATS WRONG WITH THIS CODE?
Message-Id: <380C686A.73733EAB@yahoo.com>



Jim wrote:

> #!/usr/bin/perl
>
> print "Content-Type: text/html\n\n";
> print "<HTML><HEAD>\n";
> print "<TITLE>CGI Test</TITLE>\n";
> print "</HEAD>\n";
> print "<BODY><A HREF=\"http://someplace.com\">Click Here</A>\n";
> print "</BODY></HTML>";
>
> It gives me a 500 error. All I want to know is if there are any errors in
> this code. thanks
> Jim

Concentrate when you do scripting. The error is escaping! Find out for
yourself.

APS



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

Date: Tue, 19 Oct 1999 09:36:57 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: WHATS WRONG WITH THIS CODE?
Message-Id: <380C8209.2A8AF19F@texas.net>

Jim wrote:
> 
> #!/usr/bin/perl
> 
> print "Content-Type: text/html\n\n";
> print "<HTML><HEAD>\n";
> print "<TITLE>CGI Test</TITLE>\n";
> print "</HEAD>\n";
> print "<BODY><A HREF=\"http://someplace.com\">Click Here</A>\n";
> print "</BODY></HTML>";
> 
> It gives me a 500 error. All I want to know is if there are any errors in
> this code.

Try reading the 'Idiot's Guide to Solving Perl CGI Problems', written by
tomC.  It's available at:

http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html

> thanks

Uh-huh.

- Tom


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 1116
**************************************


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