[15856] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3269 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 6 18:15:55 2000

Date: Tue, 6 Jun 2000 15:15:39 -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: <960329738-v9-i3269@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 6 Jun 2000     Volume: 9 Number: 3269

Today's topics:
    Re: PLEASE HELP: Perl for WWW <jeniNOjeSPAM@hotbot.com.invalid>
    Re: PLEASE HELP: Perl for WWW <jeniNOjeSPAM@hotbot.com.invalid>
    Re: PLEASE HELP: Perl for WWW <r.meEEEtcalfNOSPAM@exXXX.acCCC.ukKKK>
    Re: PLEASE HELP: Perl for WWW (Abigail)
    Re: PLEASE HELP: Perl for WWW (Abigail)
    Re: PLEASE HELP: Perl for WWW (Eric Bohlman)
    Re: PLEASE HELP: Perl for WWW (Jon S.)
    Re: PLEASE HELP: Perl for WWW (Jon S.)
    Re: PLEASE HELP: Perl for WWW <kperrier@blkbox.com>
        Please: need help with running .... <aakbari@crosskeys.com>
    Re: Please: need help with running .... (Abigail)
    Re: Please: need help with running .... <aakbari@crosskeys.com>
    Re: Please: need help with running .... (Abigail)
    Re: Sending HTML-rich email greggulrich@my-deja.com
    Re: Sending HTML-rich email <you.will.always.find.him.in.the.kitchen@parties>
        sort by value AND display key <nomail@nomail.com>
    Re: sort by value AND display key (Abigail)
    Re: sort by value AND display key <lr@hpl.hp.com>
    Re: sort function problems <abe@ztreet.demon.nl>
    Re: Splitting But NOT Splitting adrian.lema@usa.net
    Re: Splitting But NOT Splitting (Abigail)
    Re: Splitting But NOT Splitting (Abigail)
    Re: Tar module <randy@theoryx5.uwinnipeg.ca>
    Re: the end of perl? (Bart Lateur)
    Re: the end of perl? <flavell@mail.cern.ch>
    Re: Value of <HANDLE> construct can be "0" ??? adrian2001@my-deja.com
    Re: Wag de Ref (David Wall)
    Re: Wag de Ref <sariq@texas.net>
    Re: Why won't this interpolate please? <webqueen@my-deja.com>
        Win32 printing <gjchap99@my-deja.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 06 Jun 2000 11:26:05 -0700
From: JenX <jeniNOjeSPAM@hotbot.com.invalid>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <2f5617ba.315f0063@usw-ex0101-005.remarq.com>

Hello!

Thank you for your reply. I guess what I need to know is how to
teach myself Perl on a regular ol' PC. I don't have UNIX or a
sysadmin, and I kinda need things explained in layman's terms.

I'm just a recent graphic design grad looking to learn some more
programming (which I REALLY want to learn and am very excited
about). I know some javascript and I worked with that in a
regular text editor and put it into an HTML file. I was told
that perl was a little bit harder than javascript, but was the
next thing to learn and that if I knew Javascript, I could learn
perl. So here is what I am trying to do: Use a plain 'ol text
editor like notepad to make perl scripts and run them in
Internet Explorer. I am doing the tutorials on webmonkey.com. I
want to first learn the concepts, then make a script that will
work and be applicable in the web work I do.

Could you show me what to do? This all seems so confusing at
first. I appreciate all your help.

Thanks so much!

Jeni

* 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: Tue, 06 Jun 2000 11:27:45 -0700
From: JenX <jeniNOjeSPAM@hotbot.com.invalid>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <263bc770.31cdcfc2@usw-ex0101-005.remarq.com>

Oh, and by the way, I am going to go look at that activestate
website you mentioned...

Jeni

* 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: Tue, 6 Jun 2000 20:09:34 +0100
From: "Robert Metcalf" <r.meEEEtcalfNOSPAM@exXXX.acCCC.ukKKK>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <8hji5l$4s9k$1@athena.ex.ac.uk>

I have a brillent testing setup (win'98) you may want to look at.
I have a www server running on my machine for me to play with, Xitami free
from http://www.imatix.com/.
I also have active perl, from active State. This to is free.

Next Arm yourself with this knoledge.
CGI is a method of running apps on the server.
If you program u know that the output of a program apears on the screen.
Well, a CGI programs outputs are sent to the www browser.
CGI just recieves a request, starts a program with parameters from the www
page, then sends all the programs output back to the browser which displays
it as a www page.

You'll c Xitami comes with a simple cgi program u can use to test. If you
open it notmally, you'll see it's output in a DOS window. If u run it via
the server you;'ll see a www page.

Now you could use C++ to write progs for your system. Infact any compiler
that comes up with exe files is OK.
Now Perl is spical in that it is intreptred. Once you have installed active
Perl, you will find that at the command prompt you can type "perl myprog.pl"
at the command prompt and it will run your script. BUT if you put the perl
script into your cgi bin dir on Xitami server, the server will execute it
and return it's output.




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

Date: 6 Jun 2000 19:33:33 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <8hjjmd$sm$2@news.panix.com>

On Tue, 06 Jun 2000 09:48:32 -0700, JenX <jeniNOjeSPAM@hotbot.com.invalid> wrote
++ 
++ I am totally new to this perl thing. I am a web designer looking
++ to learn scripting and programming languages that apply to the
++ web. One of them is perl.

Wrong. Perl doesn't apply anymore to the web than C, Python or COBOL.
Perl it totally web unaware. You can do webbish things with Perl,
but you can do webbish things with a gazillion other languages.

Don't bother learning Perl just because you have to do webbish things.
Do the webbish things in a language you feel comfortable with.

++                           I have been on tons of web sites
++ looking for the basic information that nobody seems to have
++ about starting a perl file: For CGI on the web and for the sake
++ of teaching myself perl, how do i go about setting up and saving
++ a perl file?

You would use an editor, and use the save function of said editor.
Perl does not care at all which editor you use, and Perl doesn't
come with an editor either. Hell, you don't even need to save the
program to a file. Perl happely reads a program from standard input,
or from the command line.

++              Should I embed the perl in an html file?

Of course not! Perl is general purpose language, and has nothing, 
absolutely nothing to do with HTML. And neither has HTML anything
to do with Perl. Embedding Perl in an HTML file is as silly as
embedding the Brittish queen in todays horoscope. It doesn't stop
the rain.

++                                                       Should I
++ save the file as a .pl?

No. Perl doesn't care a single bit how you name your file. If you like
to use .pl as extension, then feel free. But you could use .gif or
 .funky.blue.teddy.bear as well. Or not have any dot at all in the file
name.

++                         Do I need UNIX to do this?

No. Perl runs on a myriad of operating systems. Including most Unices,
and whatever comes out of the brains of Redmond.

++                                                    I have a PC
++ with Win95 on it.

*comfort* Luckely, you can upgrade. There are several other OSses that
will run on that hardware.

++                   I was on Webmonkey trying to learn all this,
++ but they didn't give you any of this info!

Perl doesn't care.


Abigail


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

Date: 6 Jun 2000 19:36:33 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <8hjjs1$sm$3@news.panix.com>

On Tue, 06 Jun 2000 11:26:05 -0700, JenX <jeniNOjeSPAM@hotbot.com.invalid> wrote
++ 
++       So here is what I am trying to do: Use a plain 'ol text
++ editor like notepad to make perl scripts and run them in
++ Internet Explorer.


Then you might as well give up, as that isn't going to work.

To run programs written in the language Perl, you need the program
called "perl", as it is perl that executes Perl, not Internet Explorer.



Abigail


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

Date: 6 Jun 2000 19:41:05 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <8hjk4h$1q0$2@slb2.atl.mindspring.net>

JenX (jeniNOjeSPAM@hotbot.com.invalid) wrote:
: I am totally new to this perl thing. I am a web designer looking
: to learn scripting and programming languages that apply to the
: web. One of them is perl. I have been on tons of web sites
: looking for the basic information that nobody seems to have
: about starting a perl file: For CGI on the web and for the sake
: of teaching myself perl, how do i go about setting up and saving
: a perl file? Should I embed the perl in an html file? Should I
: save the file as a .pl? Do I need UNIX to do this? I have a PC
: with Win95 on it. I was on Webmonkey trying to learn all this,
: but they didn't give you any of this info!

Here's the plan I'd suggest:

1) Go to http://www.activestate.com and get and install the latest 
version of ActivePerl for Win32.

2) Make sure you're comfortable working at the Windows console prompt 
(AKA the "Dos command line"); make sure you're comfortable issuing simple 
commands and editing text files (you can use the DOS "edit" program or 
Windows Notepad to start).

3) Trying to learn Perl without a book is, IMHO, an exercise in 
masochism.  From the level of experience you describe, I'd suggest Andrew 
Johnson's _Elements of Programming with Perl_.  If a book is really out 
of the question, you'll need to search around on the Web for an 
*elementary* Perl tutorial.

4) Start learning to write simple, command-line Perl programs before 
trying to do anything involving CGI.  Otherwise you're going to be trying 
to learn a programming language and a protocol at the same time and 
you'll get frustrated because different concepts are going to be 
intertwingled in a confusing way.

5) Once you're capable of writing non-trivial command line programs, 
start reading up on the CGI protocol.  Also read the documentation for 
the CGI.pm module that comes with Perl.

6) Once you start to get the hang of what you read, install a Web server
on your local machine so that you can test your CGI scripts locally (that
way you don't have to upload them to a remote server as you debug them,
which gets tiresome very quickly).  I'd suggest installing Apache for
Win32 (available from http://www.apache.org); others have reported good
experiences with Xitami and OmniHTTPD, but setting up Apache is only
marginally harder than setting up those two (I had it set up in half an
hour) and knowing how to work with Apache is a transferrable skill.  Based
on what I've seen in the newsgroups, Microsoft Personal Web Server, which
you may already have on your machine, is considerably harder to set up
than the other three.  Note that the server you install will only be
accessible from other programs on your own machine; you don't have to
worry about it exposing all your files over the net. 

7) Start writing simple CGI programs, making sure to use CGI.pm for such
things as parameter decoding and dynamic form generation (whether to use
its methods for generating fixed HTML or generate it by hand is up to
you). 

8) Write more complex CGI programs as you get the hang of it.

Throughout the entire process, get yourself on friendly terms with Perl's 
extensive documentation (which comes with the download from ActiveState), 
and then get yourself on intimate terms with it.  Read all the FAQs, and 
at least familiarize yourself with the names of all the tutorials.

Around the time you reach step 5, start familiarizing yourself with the 
Perl modules available from CPAN (http://www.cpan.org), some of which can 
also be installed with the PPM tool that comes with ActivePerl.  Good 
Perl programmers will use a module if there's one available for a task 
rather than trying to write the code from scratch; one of the biggest 
advantages of modules is that their code is already tested and debugged.

Good luck; if you get frustrated, it probably means that either you're 
trying to run before you've finished learning to crawl, or you're trying 
to learn too many different things at the same time.  In that case, try 
to break what you're doing down into smaller steps (the very process of 
doing that will help you learn).



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

Date: Tue, 06 Jun 2000 20:06:41 GMT
From: jonceramic@nospammiesno.earthlink.net (Jon S.)
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <393d5b3f.22023298@news.earthlink.net>

On Tue, 06 Jun 2000 19:01:09 +0200, Marco Natoni <blah@nospam.com>
wrote:
>  Those questions, and many many other ones, will find an accurate
>answer on CGI Programming on the World Wide Web, by Shishir Gundavaram,
>published by O'Reilly, just for an example. ;)

Does anyone know when the new edition of this book is coming out?

TIA,

Jon


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

Date: Tue, 06 Jun 2000 20:14:59 GMT
From: jonceramic@nospammiesno.earthlink.net (Jon S.)
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <393d5b8a.22099178@news.earthlink.net>

On Tue, 06 Jun 2000 09:48:32 -0700, JenX
<jeniNOjeSPAM@hotbot.com.invalid> wrote:

>Hello,
>
>I am totally new to this perl thing. I am a web designer looking
>to learn scripting and programming languages that apply to the
>web. One of them is perl. I have been on tons of web sites
>looking for the basic information that nobody seems to have
>about starting a perl file: For CGI on the web and for the sake
>of teaching myself perl, how do i go about setting up and saving
>a perl file? Should I embed the perl in an html file? Should I
>save the file as a .pl? Do I need UNIX to do this? I have a PC
>with Win95 on it. I was on Webmonkey trying to learn all this,
>but they didn't give you any of this info!

Jeni,

I'm a newbie too who's been trying to teach myself things for a year
now.  I'd recommend going to the library and finding a good book that
explains the whole www "dance" between the server, the client, and
everything in between.  I found one called something like "how to
publish on the worldwideweb" or something like that which pretty much
went through everything from how the server works to HTML to CGI, SSI,
and java and everything else.  It might have even been by Stein.

If you want to do it right, you really need to know how the parts
interact so that you can use the right tools.

Perl, like others have said, is really just the code language that the
server uses to process server side work.  In very general terms, "CGI"
is how the client tells the server what it wants to run and the server
how to send the result back.  A good book for you on Perl with a
little bit about web CGI work is Learning Perl.  I'd suggest picking
up a copy and going straight to the chapter on using Perl on the Web.
The first few pages have a good beginning exploration.  It isn't the
holy grail, but will get you going in the right direction.

Best of luck,

Jon


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

Date: 06 Jun 2000 15:39:07 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: PLEASE HELP: Perl for WWW
Message-Id: <8D1FD4E319B1064F.D7799FD3AA430613.305681E4860D0987@lp.airnews.net>

abigail@arena-i.com (Abigail) writes:

> 
> You would use an editor, and use the save function of said editor.
> Perl does not care at all which editor you use, and Perl doesn't
> come with an editor either. Hell, you don't even need to save the
> program to a file. Perl happely reads a program from standard input,
> or from the command line.

If you must use MS$ Word as your edit do save the file as a text file.

This reminds me of a story a friend told me.  We was at a client site
and one of the employees of said client was trying to write a Hello, World
program in java.  The program would not compile, so employee asked my
friend if he could figure out what the problem was.  My friend could
not find any problems with the code, but he noticed that the employee
was writing his code in M$ Word.  Upon further investigation it was
determined that the employee was saving his source code as a Word
document.

Sometimes I think that there needs to be an intelligence test given
before someone can buy a computer....

kent
-- 
You think your Commodore 64 is really neato
What kinda chip you got in there, a Dorito?
Weird Al -- All about the Pentiums


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

Date: Tue, 06 Jun 2000 15:43:16 -0400
From: Afshin Akbari <aakbari@crosskeys.com>
Subject: Please: need help with running ....
Message-Id: <393D5454.E51515CB@crosskeys.com>

All,

I am trying to run "script" (that captures everything) at the beginning
of a perl Script.
The perl script does not pass the script line.

This is what I am doing:


system "script";
system "ls -l";

and I was hoping that I could capture the screen (like a log file)
with running script.

unfortunately i have not been able to do this,
Is there any way to do this in Perl ???

I appreciate all your help.


A.A.




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

Date: 6 Jun 2000 20:03:15 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Please: need help with running ....
Message-Id: <8hjle3$1ec$2@news.panix.com>

On Tue, 06 Jun 2000 15:43:16 -0400, Afshin Akbari <aakbari@crosskeys.com> wrote:
++ All,
++ 
++ I am trying to run "script" (that captures everything) at the beginning
++ of a perl Script.
++ The perl script does not pass the script line.
++ 
++ This is what I am doing:
++ 
++ 
++ system "script";
++ system "ls -l";

What you are doing is:  call the program "script". After that is finished,
call the shell, and have it execute "ls -l".

If you want to record everything you type as input to your program,
call script *first*, and then in the shell it starts, your program.
Not the other way around.

++ unfortunately i have not been able to do this,
++ Is there any way to do this in Perl ???

Yes. man perlopentut should have something to say about this.



Abigail


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

Date: Tue, 06 Jun 2000 16:43:55 -0400
From: Afshin Akbari <aakbari@crosskeys.com>
Subject: Re: Please: need help with running ....
Message-Id: <393D628B.E761E757@crosskeys.com>

hi,

Thanks for the info, Now I understand where the problem is.
However I do not follow as what you ment by:

"...  type as input to your program,
call script *first*, and then in the shell it starts, your program. "

Could you elaborate on that Please,

Thanks,



Abigail wrote:

> On Tue, 06 Jun 2000 15:43:16 -0400, Afshin Akbari <aakbari@crosskeys.com> wrote:
> ++ All,
> ++
> ++ I am trying to run "script" (that captures everything) at the beginning
> ++ of a perl Script.
> ++ The perl script does not pass the script line.
> ++
> ++ This is what I am doing:
> ++
> ++
> ++ system "script";
> ++ system "ls -l";
>
> What you are doing is:  call the program "script". After that is finished,
> call the shell, and have it execute "ls -l".
>
> If you want to record everything you type as input to your program,
> call script *first*, and then in the shell it starts, your program.
> Not the other way around.
>
> ++ unfortunately i have not been able to do this,
> ++ Is there any way to do this in Perl ???
>
> Yes. man perlopentut should have something to say about this.
>
> Abigail



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

Date: 6 Jun 2000 20:53:28 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Please: need help with running ....
Message-Id: <8hjoc8$2f0$1@news.panix.com>

On Tue, 06 Jun 2000 16:43:55 -0400, Afshin Akbari <aakbari@crosskeys.com> wrote:
++ hi,
++ 
++ Thanks for the info, Now I understand where the problem is.

Please, don't send stealth Cc's and don't post Jeopardy style.

++ However I do not follow as what you ment by:
++ 
++ "...  type as input to your program,
++ call script *first*, and then in the shell it starts, your program. "

Which part of the above don't you understand?



Abigail


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

Date: Tue, 06 Jun 2000 18:13:04 GMT
From: greggulrich@my-deja.com
Subject: Re: Sending HTML-rich email
Message-Id: <8hjeuv$ca1$1@nnrp1.deja.com>



> > Direct reply is better.
>
> isn't
>

in this you are correct.


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


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

Date: Wed, 7 Jun 2000 09:47:51 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: Sending HTML-rich email
Message-Id: <960327963.790057@shelley.paradise.net.nz>


<greggulrich@yahoo.com> wrote in message news:8hj6jo$596$1@nnrp1.deja.com...
> I have a PERL script that I want to have send email that contains
> HTML.  How can I do this in PERL (I am already assuming that I can)?  I
> tried CPAN but really don't know what to look for.

You want the MIME::Lite module from CPAN.




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

Date: Tue, 6 Jun 2000 13:59:51 -0400
From: "Jonah" <nomail@nomail.com>
Subject: sort by value AND display key
Message-Id: <8hjkm5$37na$1@onlink3.onlink.net>

I want to be able to display both the key and the value, but I need
this to be sorted by value. How can I do it without resorting to
temp variables? The hash is pretty big, I don't want to iterate over
it more than I have to.

 foreach my $value (sort { $b <=> $a } values %percentage)
 {
    print "$value\n";
    #print "$key";
 }

I did look in the docs and the solutions there require me to
use temp array variables, essentially juggling the data around
just so I can print both the key and the sorted value.....I'm trying
to avoid the juggling.

I was thinking something like this....

 foreach my ($key,$value) (keys sort { $b <=> $a } values%percentage)
 {
     print "$value\n";
     print "$key";
 }

 ...which doesn't work, but hopefully you see what I'm getting at.

Thanks for your help.




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

Date: 6 Jun 2000 20:15:11 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: sort by value AND display key
Message-Id: <8hjm4f$1mk$1@news.panix.com>

On Tue, 6 Jun 2000 13:59:51 -0400, Jonah <nomail@nomail.com> wrote:
++ I want to be able to display both the key and the value, but I need
++ this to be sorted by value. How can I do it without resorting to
++ temp variables? The hash is pretty big, I don't want to iterate over
++ it more than I have to.

Since a key-value relation is one-way, that is, given a key you can
find the value, but not the other way around, you cannot start by
extracting the values if you need the keys as well. So, start with the
keys, and the rest is obvious:

        foreach my $key (sort {$percentage {$b} <=> $percentage {$a}}
                                keys %percentage) {
            print "$key: $percentage{$key}\n";
        }

Of course, when your hash is big, a list of keys will be big too.



Abigail


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

Date: Tue, 6 Jun 2000 13:58:35 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: sort by value AND display key
Message-Id: <MPG.13a705dbe76d3d6498ab2d@nntp.hpl.hp.com>

In article <8hjm4f$1mk$1@news.panix.com> on 6 Jun 2000 20:15:11 GMT, 
Abigail <abigail@arena-i.com> says...
> On Tue, 6 Jun 2000 13:59:51 -0400, Jonah <nomail@nomail.com> wrote:
> ++ I want to be able to display both the key and the value, but I need
> ++ this to be sorted by value. How can I do it without resorting to
> ++ temp variables? The hash is pretty big, I don't want to iterate over
> ++ it more than I have to.
> 
> Since a key-value relation is one-way, that is, given a key you can
> find the value, but not the other way around, you cannot start by
> extracting the values if you need the keys as well. So, start with the
> keys, and the rest is obvious:
> 
>         foreach my $key (sort {$percentage {$b} <=> $percentage {$a}}
>                                 keys %percentage) {
>             print "$key: $percentage{$key}\n";
>         }
> 
> Of course, when your hash is big, a list of keys will be big too.

Good explanation, but lacking the most important part.

perlfaq4: "How do I sort a hash (optionally by value instead of key)?"

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


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

Date: Tue, 06 Jun 2000 21:08:47 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: sort function problems
Message-Id: <eoiqjssmkmm9ggsnti4803uqrbeh50ppei@4ax.com>

On 6 Jun 2000 16:21:12 GMT, compiler <tempest@entropy.muc.muohio.edu>
wrote:

> I am having a problem with the sort function. I am sorting
> titles of books, and it works sort of - no pun intended.
> I have 245 books, it sorts ~30-40 correctly then starts over
> at the letter A and sorts the rest again!
Are you shure? I would expect it start with 'A' up to 'Z' and then 'a'
up to 'z'. That sort/cmp is case-sensitive.

> Here is my sort function :
> sub byTitle { # sort by title
>    $title{$a} cmp $title{$b};
change to:
	lc $title{$a} cmp lc $title{$b};
if the above is the case.
> }

-- 
Good luck,
Abe


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

Date: Tue, 06 Jun 2000 18:23:13 GMT
From: adrian.lema@usa.net
Subject: Re: Splitting But NOT Splitting
Message-Id: <8hjfht$coe$1@nnrp1.deja.com>

Hmmmm...
I tested this code ( Sun - Solaris - perl5 ) and got:

Sequence (?<...) not recognized at tst.pl line 6

In article <f4tpjsk8o1ksf1hjsvf662scmqi6fdfjtk@4ax.com>,
  Abe Timmerman <abe@ztreet.demon.nl> wrote:
> On Tue, 06 Jun 2000 11:49:17 GMT, "Robert Young" <roberty@idirect.com>
> wrote:
>
> > Can anyone give me a regular expression to perform a split where the
> > expression is split on a character unless the character is preceded
by a
> > backslash (\) ?
>
> #!/usr/bin/perl -w
> use strict;
>
> $_ = 'this,is separated,on \, (comma),etc.';
>
> my @result = split /(?<!\\),/;
>
> print "$_\n", map "$_\n" => @result;
> __END__
>
> perldoc perlre
> look for 'negative look-behind'
>
> --
> Good luck,
> Abe
>


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


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

Date: 6 Jun 2000 18:46:56 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Splitting But NOT Splitting
Message-Id: <8hjgv0$su1$2@news.panix.com>

On Tue, 06 Jun 2000 11:49:17 GMT, Robert Young <roberty@idirect.com> wrote:
++ Can anyone give me a regular expression to perform a split where the
++ expression is split on a character unless the character is preceded by a
++ backslash (\) ?


    split /(?<!\\)/ => $string;


Abigail


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

Date: 6 Jun 2000 18:47:49 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Splitting But NOT Splitting
Message-Id: <8hjh0l$su1$3@news.panix.com>

On Tue, 06 Jun 2000 18:23:13 GMT,
adrian.lema@usa.net <adrian.lema@usa.net> wrote:
++ Hmmmm...
++ I tested this code ( Sun - Solaris - perl5 ) and got:
++ 
++ Sequence (?<...) not recognized at tst.pl line 6


Upgrade.


Abigail


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

Date: 6 Jun 2000 18:39:09 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Tar module
Message-Id: <8hjggd$263$2@canopus.cc.umanitoba.ca>

In comp.lang.perl.misc, Haris Siakalis <se97hs@dmu.ac.uk> wrote:
> i have used with success the module Tar to create a tar archive. Is
> there a way to untar the archive in perl? I have checked the docs but
> couldn't make out if i can.In my opinion I cannot.

Doesn't the extract_archive($file) method do that?

best regards,
randy kobes


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

Date: Tue, 06 Jun 2000 19:27:48 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: the end of perl?
Message-Id: <393d509d.435829@news.skynet.be>

Alan J. Flavell wrote:

>Unicode still has room  (more than "a few").

But how much of it is Ascii?

-- 
	Bart.


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

Date: Tue, 6 Jun 2000 22:55:12 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: the end of perl?
Message-Id: <Pine.GHP.4.21.0006062254050.22188-100000@hpplus03.cern.ch>

On Tue, 6 Jun 2000, Bart Lateur wrote:

> >Unicode still has room  (more than "a few").
> 
> But how much of it is Ascii?

Sorry, I'm not sure what your point is.  Ascii is a 7-bit
code, fully defined some two decades back.



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

Date: Tue, 06 Jun 2000 20:44:48 GMT
From: adrian2001@my-deja.com
Subject: Re: Value of <HANDLE> construct can be "0" ???
Message-Id: <8hjnrr$jhe$1@nnrp1.deja.com>

Thanks for your excellent explanation - The "defined" made the warning
go away.

(Upgrading is not an option; I work for a *gigantic* corporation, and
although is not as bureaucratic as other employers I've had, it is still
not easy to "move"...)

In article <8F4B7F2BDaqumsiehhyperchipcom@198.235.216.4>,
  aqumsieh@hyperchip.com (Ala Qumsieh) wrote:
> adrian2001@my-deja.com wrote in <8hj410$gj8$1@nnrp2.deja.com>:
>
> >Perl gurus,
> >I wrote a script that, when run with the -w option, gives this
> >warning:
> >
> >Value of <HANDLE> construct can be "0"; test with defined() at
> >myscript.pl line 65535
> >
>
> Upgrade to the latest version of Perl and the warning should
disappear.
> The reason is that you are probably doing something like:
>
>     	while ($line = <FH>) {
>     	    	....
>     	}
>
> In the unlikely case that $line contains the number 0, the while loop
> will terminate. This *might* actually happen if you set $/ to 0 and
> your file contains consecutive 0's.
>
> If you don't want to upgrade, then you have to change all above lines
> to:
>
>     	while (defined($line = <FH>)) {
>     	    	...
>     	}
>
> --Ala
>


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


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

Date: 6 Jun 2000 14:47:47 -0400
From: darkon@one.net (David Wall)
Subject: Re: Wag de Ref
Message-Id: <8F4B9E92Fdarkononenet@206.112.192.118>

scott@salmon.ltd.uk (Scott Pritchett) wrote in
<8hicnt$64h$1@lure.pipex.net>: 

>Now don't laugh. I'm not having any problem with the code below, but I
>have been unable to find an example in my Perl books. Does anyone see
>any potential problems with using dereferencing in this way?
>
>
>use strict;
>no strict 'refs';
>use diagnostics -verbose;
>use vars qw($Wag $red $dog);
>$::red="Wag";
>$::dog="red";
>$$$::dog="dog";
>print "$$::dog the $::Wag\n";

I asked a similar question some months ago, and got a thoughtful reply from 
Mark-Jason Dominus.  He has a series of articles on his web site explaining 
why symbolic references are generally a bad idea.  See 
http://www.plover.com/~mjd/perl/varvarname.html.  It's kind of embarrassing 
to be listed on his web site in such a role (I'm in the 2nd article), but I 
did learn something.  

-- 
David Wall
darkon@one.net


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

Date: Tue, 06 Jun 2000 14:15:37 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Wag de Ref
Message-Id: <393D4DD9.C7991102@texas.net>

David Wall wrote:
> 
> scott@salmon.ltd.uk (Scott Pritchett) wrote in
> <8hicnt$64h$1@lure.pipex.net>:
> 
> >Now don't laugh. I'm not having any problem with the code below, but I
> >have been unable to find an example in my Perl books. Does anyone see
> >any potential problems with using dereferencing in this way?
> >
> >
> >use strict;
> >no strict 'refs';

When you turn strict refs off, you'd better have a good reason.

> >use diagnostics -verbose;
> >use vars qw($Wag $red $dog);
> >$::red="Wag";
> >$::dog="red";
> >$$$::dog="dog";

BTW, that's *not* a good reason.

> >print "$$::dog the $::Wag\n";
> 
> I asked a similar question some months ago, and got a thoughtful reply from
> Mark-Jason Dominus.  He has a series of articles on his web site explaining
> why symbolic references are generally a bad idea.  See
> http://www.plover.com/~mjd/perl/varvarname.html.  It's kind of embarrassing
> to be listed on his web site in such a role (I'm in the 2nd article), but I
> did learn something.

heh.

The articles are indeed thoughtful.  Perhaps mjd will 'anonymize' you if
you ask nicely.  :)

- Tom


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

Date: Tue, 06 Jun 2000 19:06:22 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: Re: Why won't this interpolate please?
Message-Id: <8hji31$eul$1@nnrp1.deja.com>

Thanks for the replies. I actually DID suspect some sort of timing
problem, and (how show MORE of the code) had actually written this like
this:


BEGIN
{$ENV{PATH}="/bin/:usr/bin";
 $client=lc cget($user);
 print "client is $main::client\n\n"; #as you saw this works OK
 use lib qw(./ ../);
 use lib qq(../$main::client); #this did not work
       .
       .
       .

}


So I was already in a BEGIN subroutine. Didn't seem to work though.
Reading Camel suggests that

use Module == BEGIN {require Modile}

so I figure that the BEGIN that use uses has higher precedence than
mine? Is this ever tricky!

Thanks,
WQ
In article <8F4B7DB0Baqumsiehhyperchipcom@198.235.216.4>,
  aqumsieh@hyperchip.com (Ala Qumsieh) wrote:
> webqueen@my-deja.com (webqueen, queen of the web) wrote in
> <8hj4k3$3mc$1@nnrp1.deja.com>:
>
> >My code:
> >
> > print "client is $main::client\n\n";
> > use lib qq(../$main::client);
> > foreach (@INC) {print "$_ \n"}
> >
> >produces:
> >
> >   client is fish
> >
> >
> >   ../
> >
> >Where did the fish go?
>
> The 'use lib ...' command is seen at compile-time, i.e before your
> script starts to run. You seem to set $main::client at run-time, which
> is too late. Try this:
>
>     	BEGIN {
>     	    	$main::client = 'fish';
>     	    	use lib qq(../$main::client);
>     	}
>
> --Ala
>

--
Time is nature's way of preventing everything from happening at once.


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


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

Date: Tue, 06 Jun 2000 18:48:58 GMT
From: Jack Altradmon <gjchap99@my-deja.com>
Subject: Win32 printing
Message-Id: <8hjh2j$e1p$1@nnrp1.deja.com>

are there any win32 extensions that would allow a perl program to
control printers in an NT domain..?


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


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

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


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