[15746] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3159 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 25 09:05:35 2000

Date: Thu, 25 May 2000 06:05:17 -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: <959259915-v9-i3159@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 25 May 2000     Volume: 9 Number: 3159

Today's topics:
    Re: $mailCmd   = '/usr/lib/sendmail -t -n'; (Gwyn Judd)
    Re: Can't Knit Two Files Together (Gwyn Judd)
    Re: Can't Knit Two Files Together (Gwyn Judd)
    Re: can't run the perl CGI script. (Bart Lateur)
    Re: email poser (Bart Lateur)
        Filter::netcrypt <alexborshik@hotmail.com>
    Re: Finding IP addresses+ <sternberg@phys.uni-paderborn.de>
    Re: Forum for 'how to do it' questions? (Csaba Raduly)
    Re: hashes vs associative arrays (was: Re: Array Questi (Gwyn Judd)
    Re: How to COPY a website <chrisNOchSPAM@logitools.com.invalid>
    Re: how to stop strict from whining... <peter_icaza@uhc.com>
    Re: how to stop strict from whining... <peter_icaza@uhc.com>
        Interpolation of array in matching <destombe@let.uu.nl>
    Re: Interpolation of array in matching (Rafael Garcia-Suarez)
    Re: Interpolation of array in matching <destombe@let.uu.nl>
        Listing installed packages? <hmerrill@my-deja.com>
        Mail:Sender problem --pls help !! <agi@feib.com.tw>
        open fails but where ?? <bachelart.pierre@skynet.be>
    Re: open fails but where ?? (Rafael Garcia-Suarez)
    Re: open fails but where ?? nobull@mail.com
    Re: open fails but where ?? (Gwyn Judd)
        Passing data between CGI progs on different servers scottness@my-deja.com
    Re: Perl Editor for Linux (Gwyn Judd)
        Problem passing URLS sync24@my-deja.com
        randomizing (anagramming words) <kdmiles@lucent.com>
    Re: randomizing (anagramming words) (Peter J. Acklam)
    Re: randomizing (anagramming words) (Rafael Garcia-Suarez)
    Re: Reading XML documents <enders@mail.sub.uni-goettingen.de>
        run perl script in background when html loads, without  <michaelr69@eircom.net>
    Re: seeking method to encode email addresses in web pag <dave@dave.org.uk>
    Re: seeking method to encode email addresses in web pag <godzilla@stomp.stomp.tokyo>
    Re: Sorting a Database jzoetewey@my-deja.com
    Re: the use of $_ (Csaba Raduly)
    Re: updated : Re: regexes *sigh* damn I hate these thin <nospam@devnull.com>
    Re: use english <bernie@fantasyfarm.com>
    Re: What's this line which Perl added to AUTOEXEC.BAT? (Csaba Raduly)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 25 May 2000 11:43:03 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: $mailCmd   = '/usr/lib/sendmail -t -n';
Message-Id: <slrn8isoug.4tu.tjla@thislove.dyndns.org>

I was shocked! How could Michael <passagewd@primus.ca>
say such a terrible thing:
>Can anyone explain what the path could also be... this one isn't working.

Well since this is a Perl newsgroup (assuming you want to find sendmail
on your system):

#!/usr/bin/perl -w
use strict;

open LOCATE, "locate /sendmail|"
  or open LOCATE, "find / -name sendmail"
  or die "could not fork: $!";

$\ = "\n";

while (<LOCATE>)
{
 chomp;
 print if -x $_ && -u $_;
}

-- 
Gwyn "hth" Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Fay: The British police force used to be run by men of integrity.
Truscott: That is a mistake which has been rectified.
		-- Joe Orton, "Loot"


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

Date: Thu, 25 May 2000 10:58:06 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Can't Knit Two Files Together
Message-Id: <slrn8isma7.4tu.tjla@thislove.dyndns.org>

I was shocked! How could Godzilla! <godzilla@stomp.stomp.tokyo>
say such a terrible thing:
>Tom Phoenix wrote:
>> On Wed, 24 May 2000, Gwyn Judd wrote:
> 
>> You're right, of course, that a good programmer will 
>> always check the return value of open.
>
>A great programmer will do more than this,
>as I well illustrated recently, in one of
>my articles.

Didn't someone say all the truly great programmers have huge egos?

-- 
Gwyn "offtopic" Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Presidency:  The greased pig in the field game of American politics.
-- Ambrose Bierce


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

Date: Thu, 25 May 2000 11:01:00 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Can't Knit Two Files Together
Message-Id: <slrn8ismfl.4tu.tjla@thislove.dyndns.org>

I was shocked! How could Tom Phoenix <rootbeer@redcat.com>
say such a terrible thing:
>On Wed, 24 May 2000, Gwyn Judd wrote:
>
>> I don't think the "die"'s should be optional. Obviously the script will
>> die anyway when you try to read from the unopened filehandles 
>
>Unless I've misunderstood you, this turns out not to be the case. Reading
>from an unopened filehandle will generally cause a warning (if warnings
>are turned on), but will not make the program die.
>
>You're right, of course, that a good programmer will always check the
>return value of open. 

*cough* Although I meant die() in the sense that the program would call
die of course it wont. What is true (from my memory of the program
posted) is that it will eventually exit due to the fact that no input
was read. This is hardly a suitable form of error checking since you
then have to work backwards to determine where the error occured, rather
than taking the hints the system gives you (ie. return values).

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
There's a pizza place near where I live that sells only slices...
in the back you can see a guy tossing a triangle in the air...
						-- Stephen Wright


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

Date: Thu, 25 May 2000 12:29:47 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: can't run the perl CGI script.
Message-Id: <39321c5e.5304711@news.skynet.be>

JL wrote:

>Can anyone tell me is there anyway that I can run the perl CGI scipt which
>is saved in ASCII rather than binary?  Cuz' if I saved in ASCII, I can't run
>the program....but if I change it in binary, then the program run fine.
>I dont' understand why???

Heh? Are you talking about FTP? Maybe you Perl will choke on
inappropriate line endings. But I would expect the reverse.

-- 
	Bart.


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

Date: Thu, 25 May 2000 12:26:05 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: email poser
Message-Id: <39311b89.5091437@news.skynet.be>

David Fleet wrote:

>Anyone know why only 300 or so emails get through when I do a mass email to
>myself?

Maybe change your script to only send a maximum number of mails at a
time, and then pause for a few minutes (sleep()).

-- 
	Bart.


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

Date: Tue, 23 May 2000 19:46:50 -0400
From: "Alex Borshik" <alexborshik@hotmail.com>
Subject: Filter::netcrypt
Message-Id: <mz7X4.2891$uN.57337@news2-win.server.ntlworld.com>

Does anyone have any info on how to use Filter::netcrypt,

I have seen it used in some software and I was interested in using it to
encrypt some pm's I have written for a piece of software that I wish to
release.  Any information on where to obtain this from or how to use it
would be greatly appreciated




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

Date: Thu, 25 May 2000 14:51:04 +0200
From: Michael Sternberg <sternberg@phys.uni-paderborn.de>
Subject: Re: Finding IP addresses+
Message-Id: <392D21B8.F52DF554@phys.uni-paderborn.de>

Larry Rosler wrote:
> Tom Phoenix <rootbeer@redcat.com> says...
> >     http://3427256387/
> My browsers insist on filling in my local domain.  But they work on the
> dotted-quad 204.71.200.67 .
>     perl -lwe "print join '.' => unpack C4 => pack N => 3427256387"

How about the following, which also gives a bit of context and shows if the
IP is firmly set up and registered:

% nslookup 3427256387
Server:  localhost
Address:  127.0.0.1

Name:    www2.yahoo.com
Address:  204.71.200.67

> When the one-liner Perl command doesn't include shell metacharacters,
> why not use double-quotes instead of single-quotes, for portability to
> DOS shells, as I did in my example above?  It makes it easier to copy-
> and-paste, instead of having to edit the quotes.

Not good; not just for political reasons, but for "maintenance".  Even if
there are no meta-characters to begin with (meta for the shells in
question, mind you) -- as soon as you try to add some variable handling in
refinements, the " stand in the way.


Regards,
-- 
Michael Sternberg,  Dipl. Phys.          | Uni-GH Paderborn
http://www.phys.uni-paderborn.de/~stern/ | FB6 Theoretische Physik 
phone: +49-(0)5251-60-2329   fax: -3435  | 33098 Paderborn, Germany
"Who disturrrbs me at this time?"  << Zaphod Beeblebrox IV >>	<*>


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

Date: 25 May 2000 10:19:53 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: Forum for 'how to do it' questions?
Message-Id: <8F3F7D144quuxi@193.82.145.131>

21 May 2000: A formal bug report was sent to Seti@Home, because the
following message originated from bart.lateur@skynet.be (Bart Lateur)
was reported as containing signs of intelligence: 

[snip]
>
>And another thing: snip what you're replying to. I recently saw a
>post with a lot of different opinions in, about lots aof stuff.
>Somebody replied to it, quoting the whole damn post, and adding:
>"Right on!" at the top. Now tell me, what was he agreeing with? The
>lot? I don't think so.
>

Was he from AOL by any chance ? :-)

-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
Life is complex, with real and imaginary parts.

-----BEGIN GEEK CODE BLOCK----- 
Version 3.1
GCS/IT/MU d- s:- a31 C++$ UL+ P+>+++ L++ E- W+ N++ w++>$ O++$ 
M-(+) V- PGP- t+ X++ R* tv++ b++ DI+++ D++ G- e+++ h-- r-- !y+
-----END GEEK CODE BLOCK----- 


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

Date: Thu, 25 May 2000 11:57:46 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: hashes vs associative arrays (was: Re: Array Question)
Message-Id: <slrn8ispq3.4tu.tjla@thislove.dyndns.org>

I was shocked! How could Bart Lateur <bart.lateur@skynet.be>
say such a terrible thing:
>Peter Lowe wrote:
>p.s. intereted in B-Tree's? Check out Mark J. Dominus' article, at
><http://www.plover.com/~mjd/perl/BTree/>.

I don't know what it is but I can never access this site
(www.plover.com). I can access it okay as "plover.com" but not as
"www.plover.com".

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
BOFH excuse #8:

static buildup


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

Date: Thu, 25 May 2000 04:46:02 -0700
From: CptLogic <chrisNOchSPAM@logitools.com.invalid>
Subject: Re: How to COPY a website
Message-Id: <0001bd14.ae6829a2@usw-ex0105-037.remarq.com>

In article <3921C11C.99E66EDC@vpservices.com>, Jeff Zucker
<jeff@vpservices.com> wrote:
>I may want people to have access to pages within my
>site, that isn't the same as saying I encorage them to make a
copy of
>the whole site.

Why not? I bet you $BIGBUCKS that your company hands out flyers
or brochures or other printed material. That stuff stays in the
hands of the public much longer, after it's out of date, than
the pages in someones Webcache. Hell, browsers already do it. I
can set my Netscape or MSIE, as a browser, to cache a page once
and *never* check to see if it's been updated.

Why don't you want someone to look at the whole website? If they
do so much as browse it, as stated above, they'll have a cached
copy on thier hard drive. If you don't want users looking at
your web pages, don't publish on the web.

however, if they republish your content elswhere on the web
under a different URL, then that's blatant theft and is wrong
and very actionable.

>What about dynamic content -- if my site changes
>tommorrow and you are distributing outdated copies of my site
as though
>it were the real thing, what have you done to my credibility?

Most web caches will check for new pages on a site before
dishing up an old, cached copy to a user, because no user wants
to see an outdated website either. If this isn't the case, then
if you get any stick, you can gain credibility by showing some
clue and pointing to the ISP/Company IT Dept concerned and
explaining that you update content daily and the caching
arrangements need to be improved.

>I may not
>be able to stop someone from doing this, but that is not the
same as
>saying I must authorize and legitimize this simply because it is
>possible for them to do it.

And indeed you don't have to authorise them. You shove a
robots.txt file on your website telling the good robots which
bits (say, your dynamic content and/or copyrighted photos or
images) you don't want them to spider. It's also a trivial
matter to add an http deny on recognised bad robots. This is
what you have system administrators for.

I personally beleive webcaching is a Good Thing because, as a
user of an ISP, wy web surfing experience is made quicker if my
ISP has cached a load of stuff already for me so i don't have to
go out into the bandwidth bottleneck of the internet to get it.

Most webcaches check for updated pages anyway, whenever they are
asked for a website.

Hell, if you're still worried about it, you can ask the
administrator of the caching site, or the guy sucking your site
to please not do it. You may be surprised how compliant and nice
they'll be about it.

Chris. Who thinks that wget is a fantastic server migration
tool.

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Thu, 25 May 2000 07:45:28 -0400
From: "peter" <peter_icaza@uhc.com>
Subject: Re: how to stop strict from whining...
Message-Id: <8gj3mo$8m9s$1@pike.uhc.com>

thanks for the responses.




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

Date: Thu, 25 May 2000 08:48:14 -0400
From: "peter" <peter_icaza@uhc.com>
Subject: Re: how to stop strict from whining...
Message-Id: <8gj7cf$652m$1@pike.uhc.com>

>
> Yep, that's a bug. Have you filed a bug report? If you include a patch,
> that'll be helpful. Cheers!
>
hmmm,  it turns out to be an ibm module.  do you know who to contact at ibm?
maybe i can convince my admin to change the one i have as it is r--r--r--




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

Date: Thu, 25 May 2000 12:39:49 +0200
From: Louis des Tombe <destombe@let.uu.nl>
Subject: Interpolation of array in matching
Message-Id: <392D02F5.AF9F7FF5@let.uu.nl>


I do not understand the behavior of m/@array/. 

It is said to interpolate @array like within double quotes, 
but why do I get this:

program:

@a = qw (a b c);
$_='a';

print"@a ";
print "match" if /@a/;
print"\n";

$" = '|';

print"@a ";
print "match" if /@a/;
print"\n";

output:

a b c
a|b|c match


Louis

-- 
Louis des Tombe <Louis.desTombe@let.uu.nl>
Center for ICT, Faculty of Arts, Utrecht University
Kromme Nieuwe Gracht 80, 3512 HM Utrecht, The Netherlands
+31 30 253 6049


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

Date: Thu, 25 May 2000 11:46:52 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: Interpolation of array in matching
Message-Id: <slrn8iq4rl.a1e.garcia_suarez@rafael.kazibao.net>

Louis des Tombe wrote in comp.lang.perl.misc:
>
>I do not understand the behavior of m/@array/. 
>
>It is said to interpolate @array like within double quotes, 
>but why do I get this:
>
>program:
>
>@a = qw (a b c);
>$_='a';
>
>print"@a ";
>print "match" if /@a/;
>print"\n";
>
>$" = '|';
>
>print"@a ";
>print "match" if /@a/;
>print"\n";
>
>output:
>
>a b c
>a|b|c match

I don't see any bizarre behavior here.
The first test is against the pattern /a b c/, and, obviously, 'a'
doesn't match.
The second test is against the pattern /a|b|c/, and, obviously, 'a' matches.

-- 
Rafael Garcia-Suarez


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

Date: Thu, 25 May 2000 14:34:00 +0200
From: Louis des Tombe <destombe@let.uu.nl>
Subject: Re: Interpolation of array in matching
Message-Id: <392D1DB8.EFF95A27@let.uu.nl>



Louis des Tombe wrote:
> 
> I do not understand the behavior of m/@array/.

Etc, etc. 

Forget it, I was just confused.

Louis

-- 
Louis des Tombe <Louis.desTombe@let.uu.nl>
Center for ICT, Faculty of Arts, Utrecht University
Kromme Nieuwe Gracht 80, 3512 HM Utrecht, The Netherlands
+31 30 253 6049


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

Date: Thu, 25 May 2000 12:38:10 GMT
From: Hardy Merrill <hmerrill@my-deja.com>
Subject: Listing installed packages?
Message-Id: <8gj6rf$4ql$1@nnrp1.deja.com>

Is there a way to list all the "non"-standard(packages from CPAN that
are not part of standard Perl distribution) Perl packages that are
installed on your system?

TIA.
--
Hardy Merrill
Mission Critical Linux
http://www.missioncriticallinux.com


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


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

Date: Thu, 25 May 2000 10:17:44 GMT
From: Agi <agi@feib.com.tw>
Subject: Mail:Sender problem --pls help !!
Message-Id: <8giuk0$v5s$1@nnrp1.deja.com>

Hello, theres
   I want to send a mail with an attach( text or HTML with big5).
   how to set the parameters ??
   type =>???
   ctype =>???
   encoding =>???
   charset => ???
   multipart => ???

   When I test it,both the message part and attachment are renamed
   to ATTXXXXX.TXT ?
   How to change the parameters ??

Best Regards,
Agi Chen



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


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

Date: Thu, 25 May 2000 12:16:36 +0200
From: "tuple" <bachelart.pierre@skynet.be>
Subject: open fails but where ??
Message-Id: <8giugv$gdm$1@news1.skynet.be>

Hello,

Let's say i have the following line in my perl script:

open(TKG,"example") || die "can't open example: $?";

Let's say the file example doesn't exist.
So when i run this script i get : "cant open example: 0" at ./script line
xxx

But if i have the following line instead:

open(TKG,"cat example |") || die "can't open example: $?";

What i get is: "cat: cannot open abra: no such file...."
without the line number where the error occurs.
As if i have written : open(TKG,"cat example |);

What do i miss ? What should i do to see the line number ?

Pierre Bachelart.





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

Date: Thu, 25 May 2000 11:40:24 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: open fails but where ??
Message-Id: <slrn8iq4fh.a1e.garcia_suarez@rafael.kazibao.net>

tuple wrote in comp.lang.perl.misc:
>Hello,
>
>Let's say i have the following line in my perl script:
>
>open(TKG,"example") || die "can't open example: $?";

You want to use $! instead of $? here. See the perlvar document.

>Let's say the file example doesn't exist.
>So when i run this script i get : "cant open example: 0" at ./script line
>xxx
>
>But if i have the following line instead:
>
>open(TKG,"cat example |") || die "can't open example: $?";
>
>What i get is: "cat: cannot open abra: no such file...."

This is the message printed by cat on STDERR.
The pipe is open, because the cat process has been sucessfully launched, so
the 'die' will not be executed.

>without the line number where the error occurs.
>As if i have written : open(TKG,"cat example |);
>
>What do i miss ? What should i do to see the line number ?

You should test $? after you have closed TKG. Example:
close TKG or die "Error on pipe: $?";
(See perldoc -f close).

-- 
Rafael Garcia-Suarez


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

Date: 25 May 2000 12:56:25 +0100
From: nobull@mail.com
Subject: Re: open fails but where ??
Message-Id: <u9ya4yq1w6.fsf@wcl-l.bham.ac.uk>

"tuple" <bachelart.pierre@skynet.be> writes:

> open(TKG,"cat example |") || die "can't open example: $?";
> 
> What i get is: "cat: cannot open abra: no such file...."
> without the line number where the error occurs.

This error message is comming from cat not perl.  Line number is
therefore not an applicable concept.

> What should i do to see the line number ?

You can redirect the cat command's STDOUT and then process that but
it's rather a lot of work.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 25 May 2000 12:18:39 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: open fails but where ??
Message-Id: <slrn8isr18.4tu.tjla@thislove.dyndns.org>

I was shocked! How could tuple <bachelart.pierre@skynet.be>
say such a terrible thing:

<snip>

>open(TKG,"cat example |") || die "can't open example: $?";
>
>What i get is: "cat: cannot open abra: no such file...."
>without the line number where the error occurs.
>As if i have written : open(TKG,"cat example |);
>
>What do i miss ? What should i do to see the line number ?

In this case die() is not being called. The error message you see is
from the cat process.

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
A penny saved has not been spent.


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

Date: Thu, 25 May 2000 12:04:41 GMT
From: scottness@my-deja.com
Subject: Passing data between CGI progs on different servers
Message-Id: <8gj4sf$38e$1@nnrp1.deja.com>

I'm just new to Perl and want to write applications which would involve
passing data from a CGI script on one server, to another CGI
script on a different server. Can someone tell me if this can be done,
and if possible briefly how, and also point me in the direction of more
resources

Thanks,

Scot McPhie


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


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

Date: Thu, 25 May 2000 12:04:13 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl Editor for Linux
Message-Id: <slrn8isq66.4tu.tjla@thislove.dyndns.org>

I was shocked! How could Elaine Ashton <elaine@chaos.wustl.edu>
say such a terrible thing:
>in article 8ghahj$qbt$1@nnrp1.deja.com, houseofpain@my-deja.com at
>houseofpain@my-deja.com quoth:
>
>> Can anyone recomend a good Perl Editor for Linux.  Someting i can use
>> to trace through my code.
>
>Try ed.

No No! cat is the one true text editor!!!

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
A writer is congenitally unable to tell the truth and that is why we call
what he writes fiction.
		-- William Faulkner


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

Date: Thu, 25 May 2000 10:07:00 GMT
From: sync24@my-deja.com
Subject: Problem passing URLS
Message-Id: <8gitvu$upb$1@nnrp1.deja.com>

Hi all,

Whilst passing a URL to a perl script (that obtains img tags). I get
the following error :

Path components contain '/' (you must call epath) at
C:/Perl/site/lib/URI/_generic.pm line 147

I am using Active Perl on a winNT 4.0 server with MS IIS.

The program works fine for URLS with no '%' chars etc but cannot handle
URLS such as :

"http://gegcfeu26.gcf.capital.ge.com:900/Page/1/I%2FO/Plot/I%
2FO+Buffer+Hit+Rate"

I'd appreciate some comments and perhaps pointers in the right
direction to get this working.

TIA

Kev Smith


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


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

Date: Thu, 25 May 2000 12:33:59 +0100
From: Kevin Miles <kdmiles@lucent.com>
Subject: randomizing (anagramming words)
Message-Id: <392D0FA7.258A77F4@lucent.com>

If I want to randomize a word 

i.e.

England   

to be (as an example)

glnEand


How do I do this in PERL??? Can I randmize a string??
-- 
Kevin Miles


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

Date: 25 May 2000 13:48:47 +0200
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: randomizing (anagramming words)
Message-Id: <cxcd7mavoio.fsf@masterblaster.uio.no>

Kevin Miles <kdmiles@lucent.com> writes:

> If I want to randomize a word 
> 
> i.e.
> 
> England   
> 
> to be (as an example)
> 
> glnEand
> 
> How do I do this in PERL??? Can I randmize a string??

Split the words into an array of characters:

   $word = 'England';
   @chars = split //, $word;

Then shuffle the elements in @chars as described in perlfaq4: "How do I
shuffle an array randomly?".  Finally join the shuffled characters
together:

   $new_word = join '', @chars;

Peter

-- 
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];


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

Date: Thu, 25 May 2000 11:49:50 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: randomizing (anagramming words)
Message-Id: <slrn8iq517.a4t.garcia_suarez@rafael.kazibao.net>

Kevin Miles wrote in comp.lang.perl.misc:
>If I want to randomize a word 
>
>i.e.
>
>England   
>
>to be (as an example)
>
>glnEand

perldoc -q shuffle
  Found in /usr/lib/perl5/5.00503/pod/perlfaq4.pod
  How do I shuffle an array randomly?

Convert your string to an array of characters and apply the algorithm
described here.

-- 
Rafael Garcia-Suarez


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

Date: Thu, 25 May 2000 12:14:48 +0100
From: Markus Enders <enders@mail.sub.uni-goettingen.de>
Subject: Re: Reading XML documents
Message-Id: <392D0B28.73794A20@mail.sub.uni-goettingen.de>

Hi Martin,

Martin Askestad wrote:

> I'm trying to parse a XML document with Perl on a WindowsNT machine. Do
> I have to download some kind of module to do that. I'm having trouble
> with splitting the tags and getting the contents of them.

Usually you use an XML parser, to parse XML. The parser is doing a lot
more - e.g. escaping certain characters, using the correct encoding
scheme and so on... 
You could use the XML::Parser module from cpan.

I would prefer to use the DOM (DocumentObjectModel). For perl there is
only a DOM-Module (also from cpan) supporting level 1. But this seems to
be enogh for most purposes.

You can even download the binary for ActivePerl at ActiveState, just use
the ppm to install it.

Ciao
Markus


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

Date: Thu, 25 May 2000 11:30:06 GMT
From: mick <michaelr69@eircom.net>
Subject: run perl script in background when html loads, without user intervention
Message-Id: <siq3lubno154@corp.supernews.com>

can anybody help me
when the html document loads
i want a perl script to be executed 
the perl script will not return any info to the browser,
instead it will fire off an email

any help would be appreciated

thanks
mick

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Thu, 25 May 2000 11:30:10 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <mvvpisk8smnd24ru40u1dua0v5du4arfi2@4ax.com>

On Thu, 25 May 2000 02:19:24 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:

[stuff snipped]

>Here are four methods I tossed together for you. First
>one is very standard ROT-13 encoding, 

[snip]

>Second method is a mimic of ROT-13 but with a bit of
>a twist.

[snip]

>Method four is HEX encoding.

[snip]

>Last method, number five, would kick butt on most robots.

You're doing it on purpose aren't you?


>
>print "Method Three, HEX: \n\n";
>
># encode:
>
>$email =~ s/(.)/ sprintf('%02x',ord($1)) /ge ;
>
>print "Method Three, encode: $email \n";
>
># decode:
>
>$email =~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
>
>print "Method Three, decode: $email \n\n";

I think that reading the manual pages on 'pack' and 'unpack' would
give you an easier way to write these methods.


hth,

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Thu, 25 May 2000 02:49:50 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <392CF73E.CF557CC6@stomp.stomp.tokyo>

"Godzilla!" wrote:
 
> Bob Reap wrote:
 
> (some snippage)
 
> Here are four methods I tossed together for you. First
           ^^^^                                    ^^^^^

> Second method is a mimic of ROT-13 but with a bit of
  ^^^^^^
 
> Method four is HEX encoding. I kinda think there might
         ^^^^
 
> Last method, number five, would kick butt on most robots.
                      ^^^^


Hmm... well... guess I have proved beyond any
doubt I am an airhead. Anyone care to disagree?

* at last, everyone agrees with me *

I knew you would see things my way, eventually.

Godzilla!


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

Date: Thu, 25 May 2000 12:25:34 GMT
From: jzoetewey@my-deja.com
Subject: Re: Sorting a Database
Message-Id: <8gj63e$455$1@nnrp1.deja.com>

In article <8ghupm$ijg$6@slb6.atl.mindspring.net>,
  ebohlman@netcom.com (Eric Bohlman) wrote:

> Do you actually need to sort the database itself, or just to retrieve
> records in a particular order?  If the latter, take a look at Jeff
> Zucker's DBD::RAM (in fact, it could be adapted if you had to do the
former).
>

Being able to retrieve the records in a particular order would be good
enough.

Is there an easy way to do that?

Jim


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


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

Date: 25 May 2000 10:31:51 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: the use of $_
Message-Id: <8F3F7E2D5quuxi@193.82.145.131>

22 May 2000: A formal bug report was sent to Seti@Home, because the
following message originated from
you.will.always.find.him.in.the.kitchen@parties (Tintin) was reported
as containing signs of intelligence: 

>
>"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
>news:3928B1B1.FEE549E6@stomp.stomp.tokyo...
>> Tintin wrote:
>>
[snip]
>>
>> *shrugs*
>>
>> This is reality.
>
>Reality for a very small minority.
>

Reality is for those who can't cope with drugs :-)
I wonder what Purl^H^H^H^HGodzilla is on (permanently) ?

-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: 25 May 2000 12:44:59 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: updated : Re: regexes *sigh* damn I hate these things
Message-Id: <8gj78b$okg$0@216.155.33.25>

In article <392a437f.950257@news.skynet.be>, bart.lateur@skynet.be 
(Bart Lateur) wrote:

 | The WebDragon wrote:
 | 
 | > | This gives:
 | > | 
 | > | 	Name = utdm/dm-cyberwar.zip, rating = 7.5
 | > | 	Name = utdm/dm-nitro.zip, rating = 9
 | > 
 | >well, this is close.. but you missed the part above where I mentioned 
 | >that I needed to *extract* the gametype from the name. 
 | >
 | >Ultimately I'll have as output.. 
 | >
 | >Gametype = utdm, filename = dm-cyberwar(*1), rating = 7.5
 | >Gametype = utdm, filename = dm-nitro, rating = 9
 | 
 | I thought that was rather trivial. For example, instead of using
 | 
 | 	$name = $1 if defined $1;
 | 
 | you can do:
 | 
 | 	if defined($1) {
 | 	    ($gametype, $name) = split /\//, $1;
 | 	    $name =~ s/\.[^.]*$//;
 | 	}

this should actually be 

    if (defined $1) {

but otherwise it works

now what I've done with it is this: 

my($gametype, $name, $rating, $mapcount);
foreach my $filez (sort @fileslist) {
    my @filedata = ();
    my $inputfile = File::Spec->catfile( $inputDir, $filez);
    open(IN, "<$inputfile") or die("Can't open $inputfile : $!\n");
        while (<IN>) {
            s/\012//; #'scuse the silly linewrapping below
            if (/Name: +<a +href="http:[^"]+\?nalicity\//gi .. 
/\G([^"]+)"/g) { 
                if (defined $1) {
                       ($gametype, $name) = split /\//, $1;
                       $name =~ s/\.[^.]*$//;
                   };
            } elsif (/Rating: +\(1-10\) +([\d\.]+)/) {
                $rating = $1;
                $listing{$gametype}{$name} = $rating;
                ++$mapcount;
                last;
            }
       }
    close(IN);
}

is there an easier way to get a count of the $name(s) than this? I can 
do a scalar(keys %listing) to get a count of the gametypes found, but 
how do I get a count of the $listing{*}{$name} keys ? is there a 
shortcut or no?

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 25 May 2000 08:40:17 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: use english
Message-Id: <hn7qis4f9kocpjpfnofbvrrm6p9i9i2hps@news.supernews.com>

Michael Carman <mjcarman@home.com> wrote:

} Sandy Barnabas wrote:
} > 
} > I'm a fairly new perl programmer, and I "use english" in most (if 
} > not all) my scripts.  Recently, a friend has told me that "use 
} > english" is not used by serious perl programmers and is against the
} > perl idiom; and that I should learn the shorthand form of the 
} > variable names.  I was wondering if this is indeed the case or not.
} 
} Most experienced Perl hackers don't use the long names for built in
} variables, but that's because we're lazy and don't want to type
} $INPUT_RECORD_SEPERATOR' when we can get by with '$/'.

Not to mention that we'd have to hassle to get those long names spelled
correctly...:o)

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: 25 May 2000 10:40:34 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: What's this line which Perl added to AUTOEXEC.BAT?
Message-Id: <8F3F75382quuxi@193.82.145.131>

23 May 2000: A formal bug report was sent to Seti@Home, because the
following message originated from waldo700NOwaSPAM@aol.com.invalid
(bjanko) was reported as containing signs of intelligence: 

>These are some great and useful comments.  I didn't know that
>info about %PATH% before.  I'll add them in, as well as the c:
>\windows\command
>
>Thanks for your time in responding!
>

AFAIK, Lose9x will magically add c:\windows and c:\windows\command (or 
whatever it's installed in) to the path AFTER autoexec.bat has 
finished, UNLESS they are already there. That's how it can work without 
autoexec.bat or config.sys existing at all.

c:\windows\command contains commandline tools from the DOS era: xcopy, 
format, etc.

-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

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


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