[15802] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3215 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 30 21:15:37 2000

Date: Tue, 30 May 2000 18:15:28 -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: <959735727-v9-i3215@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 30 May 2000     Volume: 9 Number: 3215

Today's topics:
        Please help me with this ONe? <dchk_78NOdcSPAM@yahoo.com.invalid>
    Re: Please help me with this ONe? <flavell@mail.cern.ch>
    Re: Please help me with this ONe? <tina@streetmail.com>
    Re: Regex prime numbers (Was Re: seeking method to enco <lr@hpl.hp.com>
    Re: Regex prime numbers (Was Re: seeking method to enco (Abigail)
    Re: Replace a string with another (Abigail)
    Re: security problems in Perl code jdimov@my-deja.com
    Re: seeking method to encode email addresses in web pag <godzilla@stomp.stomp.tokyo>
    Re: Simple Perl syntax question (Abigail)
    Re: simple regexp question (Abigail)
    Re: some inbuilt function in perl!! (Abigail)
    Re: Use Win32::ODBC; <carvdawg@patriot.net>
    Re: What do I need to write my first perl program?? (Abigail)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 30 May 2000 16:43:43 -0700
From: Chung Derek <dchk_78NOdcSPAM@yahoo.com.invalid>
Subject: Please help me with this ONe?
Message-Id: <0f380c77.9a20daea@usw-ex0106-046.remarq.com>

i have programmed a perl script under unix emvironment.

now, i am porting it to windows environment.

the question?

my previous script have some command suck as "unlink" to delete
a specified file. do i need to change to (eg. del file.txt)?
basically, my question is can are this command based from unix
command , or perl? If the latter, can I assume the function can
be used no matter where I port the script, right.



this would really be  a great help. thnaks

* 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: Wed, 31 May 2000 02:04:38 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Please help me with this ONe?
Message-Id: <Pine.GHP.4.21.0005310201330.3646-100000@hpplus01.cern.ch>

On Tue, 30 May 2000, Chung Derek wrote:

> now, i am porting it to windows environment.

> my previous script have some command suck as "unlink" to delete
> a specified file. do i need to change to (eg. del file.txt)?

It looks as if it's time that you found the documentation that comes
with the Windows version of Perl that you're using.

[..]
> If the latter, can I assume the function can
> be used no matter where I port the script, right.

Well, you seem to have the right idea about which question to ask.
Now try researching that question in your documentation.  Then you'll
be all set for the next question that's going to come up.

good luck.



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

Date: 31 May 2000 00:21:44 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Please help me with this ONe?
Message-Id: <8h1luo$2716d$5@fu-berlin.de>

hi,

Chung Derek <dchk_78NOdcSPAM@yahoo.com.invalid> wrote:
> i have programmed a perl script under unix emvironment.

good.

> now, i am porting it to windows environment.

why? ;-)

> my previous script have some command suck as "unlink" to delete
> a specified file.

well, that's excellent. better than it would've used system("rm")

> do i need to change to (eg. del file.txt)?

hm, you could try it out and you will see:
there is no del.
unlink is just the right command for deleting.
look at
perldoc -f unlink to see how it works and get a better
understanding why it's called unlink.


tina

-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Tue, 30 May 2000 15:57:17 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Regex prime numbers (Was Re: seeking method to encode email addresses in web page forms)
Message-Id: <MPG.139de72bbb76bc6798ab06@nntp.hpl.hp.com>

In article <8h1dbd$7h8$2@216.155.32.165> on 30 May 2000 21:54:53 GMT, 
The WebDragon <nospam@devnull.com> says...

 ...

>  | > Okay that's got me curious. What is this regex prime number generator?
>  | 
>  | Do you mean this one?
>  | 
>  | perl -wle '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_ ++'

 ...

> owie. neat, but it seems to have some sort of problem on my machine :/ 
> crashes and hangs somewhere around 5000 

I started my workstation when I began entering this, and it is now above 
60000.  You do have a problem of some sort.

> I look at this and look at this and still don't really grok it. anyone 
> got a link to a nice explanation of this for the serious newbies like 
> myself? :)

Slightly shorter:

     perl -le '(1 x $_) !~ /^(11+)\1+$/ && print while ++$_'

It is startlingly simple.  The most imprtant conceptual hurdle is to 
realize that those '1's have nothing to do with the number 1.  They 
could be any character at all.

     perl -le '("z" x $_) !~ /^(zz+)\1+$/ && print while ++$_'

Take a string of length $_ <'z' x $_>.  See whether it can be divided 
into segments of equal length, where each segment is at least two 
characters long <zz+> and there is at least one more such segment <\1+>.  
If the string cannot be so divided, its length $_ is prime, so print it.  
In any case, add 1 to the length of the string and try again.

It is difficult to imagine a less efficient algorithm.

I was amazed and impressed to find this problem presented in Andrew L. 
Johnson's "Elements of Programming with Perl".  As you can see, it is 
really quite transparent.  But what a waste of resources!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 30 May 2000 23:35:47 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Regex prime numbers (Was Re: seeking method to encode email addresses in web page forms)
Message-Id: <8h1j8j$7ba$2@news.panix.com>

On Tue, 30 May 2000 15:57:17 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
++ 
++ Slightly shorter:
++ 
++      perl -le '(1 x $_) !~ /^(11+)\1+$/ && print while ++$_'

And still shorter:

        perl -le '{(1 x ++$_) !~ /^(11+)\1+$/ && print; redo}'

        
Abigail


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

Date: 30 May 2000 23:26:50 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Replace a string with another
Message-Id: <8h1inq$7ba$1@news.panix.com>

On Sat, 27 May 2000 21:09:59 +0100, JoeB <joeb@jagas.demon.co.uk> wrote:
++ Hello All,
++ 
++ I need a function that will take a word and replace it with another as
++ in:
++ "Mango and Fruit" I want this string to be "Mango +Fruit"
++ I have tried:
++     my $vale = "Mango and Fruit";
++      $vale =~ tr/ and /+;
++ It doesn't work.

"Doesn't work" is a funny way of saying "doesn't compile".

What makes you think of using tr///, and what makes you think of doing
it this way?

++ On the other hand, if the value of $vale is:
++ my $vale = "Mango  and     Fruit";
++ 
++ I still want it to be clever and convert it to:
++ "Mango +Fruit"
++ 
++ Any help will be appreicated.


You might want to need the s/// operator, as discussed in perlop and perlre.


Abigail


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

Date: Tue, 30 May 2000 22:41:01 GMT
From: jdimov@my-deja.com
Subject: Re: security problems in Perl code
Message-Id: <8h1g1q$1m3$1@nnrp1.deja.com>

In article <u9itvw56ie.fsf@wcl-l.bham.ac.uk>,
  nobull@mail.com wrote:

> > >     - not using Perl taint mode for CGI scripts
>
> > This above will prevent any of the prior constructs from being used
> > in an unsafe way.
>
> I used to believe that.  Indeed I said it here once and was corrected
> (by Tom).  open() accepts a tainted filename for read-only opens.
> This means that a poor validation in a CGI script may give the distant
> user access to any file to which the HTTP daemon has access.
>

Is this an intentional ommision of taint mode, or is it a bug?

Is there anything else that taint mode doesn't take very good care of?


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


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

Date: Tue, 30 May 2000 15:13:13 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <39343CF9.48CB6CC9@stomp.stomp.tokyo>

The WebDragon wrote:
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>  | The WebDragon wrote:

> tactless, and more than exceptionally insulting 
> considering you don't even know what RACE of HUMAN I am


Give it a break will you? How many years
have we known each other? As if I don't
know you and your background.

jeeeshhh...

If these people only knew what I know.

Now lighten up and stop trying to boss 
me around. You know well you cannot.


Godzilla!


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

Date: 31 May 2000 00:06:47 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Simple Perl syntax question
Message-Id: <8h1l2n$7ba$8@news.panix.com>

On Mon, 29 May 2000 14:30:35 GMT,
Owen Sullivan <owen.sullivan@worldzap.com> wrote:
++ I know this is a simple question, but I don't see the answer in the FAQ or
++ my Perl book.

Then look again. Not only is it in the FAQ, it's also being asked here 
in this group about 46 times a day.



Abigail


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

Date: 30 May 2000 23:47:13 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: simple regexp question
Message-Id: <8h1ju1$7ba$4@news.panix.com>

On Sat, 27 May 2000 19:09:47 -0500, Barry Grupe <eggrock@skypoint.com> wrote:
++ I'd like to test for a valid domain name, where domain may equal the
++ following:
++ domain.xxx
++ subdomain.domain.xxx
++ subdomains.ad.nauseum.at.domain.xxx
++ 
++ (My ignorance of DNS may show here, but it's irrelevant to the question ;)
++ Domain Naming Rules:
++ Domains must begin with an alpha char, may contain alphanumeric, '-' and
++ '.'.
++ Domains must end with a '.' followed by 2-3 alpha chars (but no more!).
++ A '-' may not be the char immediately before a '.'.
++ No adjacent '.'s.

Well, that's easy. Just write each of the rules down in the regex:

    m{
       ^[a-z]               # Starts with alpha char
       (?:                  # followed by
          [-a-z0-9]+        #   alphanums or dashes
          |                 #   or
          (?<!-)\.(?!\.)    #   a dot not preceded by a - or followed by a dot
       )*                   # repeated as often as needed
       \.[a-z]{2,3}         # with a dot and 2 or 3 alpha chars
       \z                   # at the end
      }ix                   # case insenstive.


Now, this allows domains like:

    a.----------0.foo

but that's according to your specification.


Abigail


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

Date: 31 May 2000 00:08:16 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: some inbuilt function in perl!!
Message-Id: <8h1l5g$7ba$9@news.panix.com>

On Mon, 29 May 2000 14:30:04 GMT, Arun Mahajan <arun67@yahoo.com> wrote:
++ hello everybody,
++ 
++ i am new to perl and just looking strangly when i find a in-built function 
++ in some program. Is there anybody who could help me to find some site which 
++ provides the list and description of these functions.


There's 70,000 lines of Perl documentation coming WITH EVERY STANDARD
DISTRIBUTION of Perl.


Look at your own hard drive.



Abigail


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

Date: Tue, 30 May 2000 19:11:45 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Use Win32::ODBC;
Message-Id: <39344AB1.6F9EA23D@patriot.net>

Which version of Perl are you using?  It may not be ActiveState's ActivePerl

Cedron Johnson wrote:

> I have installed the Win32::ODBC module but when I add the following
> code:
>
> Use Win32::ODBC;
>
> to my script I receive the following error:
>
> The dynamic link library PerlCRT.dll could not be found in the specified
> path...
> This dll does not live on my hard drive at this time.  Can any one tell
> me what I have missed?  Thanks.
>
> Cedron



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

Date: 30 May 2000 23:55:46 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: What do I need to write my first perl program??
Message-Id: <8h1ke2$7ba$5@news.panix.com>

On Sun, 28 May 2000 09:26:37 +0200, Nelly Hemp <N.Hemp@wanadoo.fr> wrote:
++ Hi, I am trying to find out what I need to install onj my PC computer to
++ write and test perl programs.


Foreground memory. 
Background memory will be very convenient.
An input device.
An output device.

The rest is pure luxery.



Abigail


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

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


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