[11123] in Perl-Users-Digest
Perl-Users Digest, Issue: 4723 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 22 15:06:31 1999
Date: Fri, 22 Jan 99 12:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 22 Jan 1999 Volume: 8 Number: 4723
Today's topics:
Re: "News Group Not Found" dturley@pobox.com
A question about filehandle <zzhang@bayou.uh.edu>
Re: A question about filehandle (Thomas Brian Holdren)
Re: ancestry of perl features <uri@home.sysarch.com>
CDDB Lookup? <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
Re: First line skip when reading file <ludlow@us.ibm.com>
how to attach to an FPNW Machine <stephen@chiso.com>
Identify a line (Gigatron)
job hit counts, a mini unscientific survey (Randal L. Schwartz)
Re: Looking for free Web Server with CGI <myparu@_usa_.net>
MacPerl crashes when another process hogs the CPU for t (Michael Ferrante)
Memory used by a script? martinez5400@my-dejanews.com
Modifying arrays <kiml@worldnetla.net>
Re: Modifying arrays <Tony.Curtis+usenet@vcpc.univie.ac.at>
My in OOP (Thomas Brian Holdren)
Number of PERL downloads <ddsa@rhsmith.umd.edu>
Perl editor ? <len.belyakov@inrange.com>
Re: Perl problem :(Offline mode... <andrewf@beausys.demon.co.uk>
Re: PROOF: Schwartz is LORD of the Transform! (Randal L. Schwartz)
read line by line in perl (Gigatron)
Re: read line by line in perl (I R A Aggie)
regular expression help josh@sequoiasoft.com
Replacing Carriage Returns with commas?? <trenic@nortelnetworks.ca>
SMTP / ESMTP modules <kluff@enterprise.net>
thanks (Lori Flynn )
Re: The Documeantion (was Re: Perl problem :(Offline mo <andrewf@beausys.demon.co.uk>
Re: Undefining $1 after regexp match ptimmins@netserv.unmc.edu
Writing files <alcazar@netcomp.net>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 22 Jan 1999 18:44:23 GMT
From: dturley@pobox.com
Subject: Re: "News Group Not Found"
Message-Id: <78agu4$9rj$1@nnrp1.dejanews.com>
In article <36a88639.270890@news.skynet.be>,
bart.lateur@skynet.be (Bart Lateur) wrote:
> I think that was "KernelKlink"'s point. What if you consider Perl as a
> MS competitor too...
Then I would look for something in win2000 that will maliciously break Perl.
:-)
--
____________________________________
David Turley
dturley@pobox.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 12:44:50 -0600
From: Zhengdong Zhang <zzhang@bayou.uh.edu>
Subject: A question about filehandle
Message-Id: <36A8C722.32D7@bayou.uh.edu>
Hello everyone.
I have a question about how to open a filehandle associated with a file
in a directory other than the current working directory.
I can specify the directory in the "open" function, like so:
open(FILE_A, "/zzhang/data/a") || die "$!";
But if I use the following code and input the name(including the path)
of a file in a directory other than the current working directory, I
will get an error message.
print "Enter the filename: ";
$in = <STDIN>;
chomp $in;
open(IN, "$in") || die "$!";
My current working directory is /zzhang. When I run the program I enter
/zzhang/data/a at the prompt. I get an error message like "No such
file." Is it possible to specify the directory of a file at run time
when open a filehandle?
Thanks,
Z.Zhang
------------------------------
Date: 22 Jan 1999 19:14:52 GMT
From: irc_addict@hotmail.com (Thomas Brian Holdren)
Subject: Re: A question about filehandle
Message-Id: <78ainc$jh1@trakker.mcdermott.com>
Try
open(FILE, ">$filename") || die blah blah
--
tbholdren
------------------------------
Date: 22 Jan 1999 14:14:55 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: ancestry of perl features
Message-Id: <x7btjrunkg.fsf@home.sysarch.com>
>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
TC> In comp.lang.perl.misc, Uri Guttman <uri@ibnets.com> writes:
TC> No, FORTRAN, and thence I believe to BASIC. All your PL/I notions are
TC> false, because Larry wasn't a PL/I guy. He was a BASIC-PLUS guy.
TC> Keep that in mind.
but i believe pl/i precedes basic for many of the string ideas. pl/i had
a substr function by the same name. early basics i used (pdp-8) had only
single letter and 1 digit names and not much else! also see MJD's take
on perl and PL/I at http://www.plover.com/~mjd/perl/#perl67
TC> :scalar range (..) awk (list .. is perl)
TC> Editors. Sed and Awk.
i said (sed?) awk. is the list .. from perl only?
TC> :bind (=~) awk
TC> :substr PL/I
TC> Nope, awk.
PL/I had is first. it precede awk by several years.
TC> :lists lisp, apl
TC> and shell.
TC> :slices apl
TC> Um, doesn't Ada have this, and later versions of Fortran?
TC> I'm trying to remember whether BASIC-PLUS did.
and perl probably precedes (or around the same time) as ada. i seem tot
gather that larry knew about apl when he did perl. which version of perl
first supported slices? was it as early as the first version with arrays?
TC> But you're really forgetting a bunch.
i said add stuff. i wasn't trying to be complete but to start a thread
on this topic.
TC> blocks Algol
TC> # comments shells
TC> system functions Unix libc
i had this one.
TC> control flow:
TC> do{}, if(), while(), for C
and this.
TC> It's more interesting to figure out what *IS* original,
TC> unique unto Perl. There are quite a few mysteries yet.
TC> I'll let you start that list yourself. :-)
well i started the inverse list.
TC> "If you think Emacs is such a great editor, just look what it did for
TC> Richard Stallman's typing skills!"
he just had bad body mechanics and had a keyboard chained to his
wrists. if he had taken better care of himself (wristpads, ergonomic
furniture, proper and early treatment, etc.) he would have to have a
typist. i don't think associating emacs and carpal tunnel syndrome is
going to win you any converts to vi.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 22 Jan 1999 10:52:38 -0500
From: Ketan Patel <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
Subject: CDDB Lookup?
Message-Id: <36A89EC5.680A20E5@BLAHNOSPAMBLAHxwebdesign.com>
Is there any way to get information on a CD from a CDDB server based on
the UPC # (example: 2438-40861-2) via perl?
------------------------------
Date: Fri, 22 Jan 1999 13:28:57 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: First line skip when reading file
Message-Id: <36A8D179.99AF92D2@us.ibm.com>
Gary C. New wrote:
>
> I've narrowed my problem down to this:
>
> When trying to use a simple while loop to read in multi. lines from a
> text file the first line of the file is always skipped.
>
> # This opens the index.dat file for reading into @temp
> open(INDEX_DAT, "index.dat") || die "Can't open index.dat.\n";
> while (<INDEX_DAT>) {
> @temp = <INDEX_DAT>;
> }
> close(INDEX_DAT);
> Any clues as to why this is happening?
You need to re-read about <>. Your first line is being sucked up by the
conditional in your while statement. <INDEX_DAT> in this context is the
same as saying $_ = <INDEX_DAT>.
Either go through the file one line at a time with a while loop or read
it into an array. Don't try to do both.
while (<IN>) {
push @temp, $_; # or whatever you want to do with the line
}
- or simply -
@temp = <IN>;
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: Fri, 22 Jan 1999 13:12:34 -0600
From: "Stephen M. Shelly" <stephen@chiso.com>
Subject: how to attach to an FPNW Machine
Message-Id: <36A8CDA2.1850A508@chiso.com>
I am trying to distribute a perl script that will run an executable from
an NT machine running FPNW (File and Print Services for Netware). I need
to map a drive to this machine as a particular user, send the password,
and run a setup.exe from the mapped drive.
Does anyone know how I can accomplish this?
I have used open(HANDLE, "|net use ........ /USER:username, and I am
trying to put the password into this handle's stdin, but am a little
confused.
Any and all help is greatly appreciated.
Peace
------------------------------
Date: Fri, 22 Jan 1999 19:29:55 GMT
From: mikeob@itas.netnospam (Gigatron)
Subject: Identify a line
Message-Id: <36afd171.22514784@news.mtt.net>
Hello All,
How do I identify a line?
from a text file with many lines?
------------------------------
Date: 22 Jan 1999 11:25:20 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: job hit counts, a mini unscientific survey
Message-Id: <m1zp7bjejj.fsf@halfdome.holdit.com>
Using Dejanews, I counted the number of times each of the following
words appeared in "misc.jobs.offered" from 1 Oct 98 to today (about 15
weeks):
Unix 870K (queried as "unix | linux")
C 510K (includes C++)
Basic 390K (includes "visual basic")
Cobol 240K
HTML 210K
Perl 140K <<<<<< ding ding ding
Excel 120K
CGI 61K
Smalltalk 26K
TCL 11K
Fortran 10K
PL/1 7K
Lisp 3K
Python 2K
Note that Lisp beat out Python. :)
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sat, 23 Jan 1999 00:13:04 +0530
From: Murali Ravipudi <myparu@_usa_.net>
Subject: Re: Looking for free Web Server with CGI
Message-Id: <36A8C6B8.1420917@_usa_.net>
Yes, I too suggest apache.
I was using apache on NT, took me 5 minutes to install, configure and
get it up and running successfully. including CGI.
Murali.
dave@mag-sol.com wrote:
>
> In article <36A0CF1E.74D1E596@hamptons.com>,
> Chris <chrisl@hamptons.com> wrote:
> > Hi
> >
> > Are there any free Web servers for Win98 (even trial versions) that
> > allow me to mess around with CGI & Perl? Last time I tried this (years
> > ago), PWS was supposed to do it but it was broken (or I was broken, or
> > something)
>
> Get Apache from <http://www.apache.org>
>
> --
> Dave Cross
> Magnum Solutions Ltd: <http://www.mag-sol.com/>
> London Perl M[ou]ngers: <http://london.pm.org/>
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 19:36:43 GMT
From: psu22377@odin.cc.pdx.edu (Michael Ferrante)
Subject: MacPerl crashes when another process hogs the CPU for too long
Message-Id: <36a8d23c.87730940@news.uswest.net>
Running MacPerl 5.2.0r4 on a Power Mac G3 233 w/128Mb RAM, running
MacOS
8.5
I have a perl script that launches an application, then periodically
checks to see if that launched process has exited. The application is
standard ANSI C++, and so the way it runs on MacOS, the launched
application does not yield back any processor time. The whole
machine, including Perl, is essentially "frozen" while the launched
application runs (MacPerl does not get any processor time, not even
enough to update it's spinning cursor). When the application exits,
MacPerl gets some processor time once again and continues to run the
script.
The problem comes if the application runs for upwards of an hour
before exit. This means that basically MacPerl is suspended for about
an hour. MacPerl crashes with a Type 1, Type 3 or a Type 11 error. Is
there any reason why MacPerl, if "suspended" by another process
hogging the CPU, would crash? I downloaded the source for MacPerl and
looked around the main event loop. Is there anything with a call to
sleep() that might result in a problem if perl was suspended then
resume an several hours later?
The perl script launches the C++ application in parallel with
Mac::Processes, LaunchApplication. the process hash %Processes is
used to check whether the application is running or not.
the CPU, the more likely for MacPerl to crash when it finally gets
some CPU time.
the perl script had a while loop checking if the processes exited,
with a call to sleep from perl (i.e. sleep 10;) before continuing in
the while loop. Could the command sleep, if MacPerl were frozen in
the middle of execution of a perl script's "sleep" for a few hours,
would MacPerl possibly crash on regaining processor time?
I was thinking that maybe there would be some kind of overflow problem
if MacPerl was trying to return how many seconds were actually "slept"
if it were frozen for a long time.
thanks,
Michael Ferrante <psu22377@odin.cc.pdx.edu>
------------------------------
Date: Fri, 22 Jan 1999 18:22:16 GMT
From: martinez5400@my-dejanews.com
Subject: Memory used by a script?
Message-Id: <78afka$8ff$1@nnrp1.dejanews.com>
Hello,
I need to to determine how much memory a perl script is using at any given
time.
Is there a way to do this in perl?
Would I need to call a C function?
Any help on this would be great.
Thanks in advance,
Juan
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 12:18:38 -0600
From: "Kim Long" <kiml@worldnetla.net>
Subject: Modifying arrays
Message-Id: <36a8c060.0@209.4.101.246>
Is there a way to remove a value from an array, such that
@array = (15, 16, 17, 18, 19, 20);
$value = $array[0]; #value is equal to
15 - pass to other portion of script
then somehow delete $array[0] so that
@array = (16, 17, 18, 19, 20);
I want to create a diminishing pool of items, where the first value is used
and discarded.
KimL
kiml@worldnetla.net
------------------------------
Date: 22 Jan 1999 19:17:44 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Modifying arrays
Message-Id: <83pv87p3xz.fsf@vcpc.univie.ac.at>
Re: Modifying arrays, Kim <kiml@worldnetla.net>
said:
Kim> then somehow delete $array[0] so that @array =
Kim> (16, 17, 18, 19, 20);
Kim> I want to create a diminishing pool of items,
Kim> where the first value is used and discarded.
perldoc -f shift
perldoc -f pop (for completeness)
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 22 Jan 1999 18:41:37 GMT
From: irc_addict@hotmail.com (Thomas Brian Holdren)
Subject: My in OOP
Message-Id: <78agp1$jh1@trakker.mcdermott.com>
Dear Perlers,
I am currently working on my first .pm that uses a variable that needs to be
read by both the module and the calling script. Unfortunately, as a creature
of habit, I like to use strict vars in all I do. Meaning a "my" declaration
for $module::var. But, I cannot seem to get the value for $module::var from
the calling script when I use "my" on it. I know that "my" doesn't store the
variables it modifies in the package namespace (I think), and that that is why
I can't get to it.
My question is... is there anyway I can get at this "my" variable? (I don't
think "local" is what I'm looking for). Should I just give up and throw away
my precious strict vars?
This probably has a simple answer that I'm not seeing. Can't seem to find it
in the Camel book. What blatantly obvious thing am I missing?
Thanks.
--
tbholdren
JAPN --Just Another Perl Newbie
------------------------------
Date: Fri, 22 Jan 1999 13:41:13 -0500
From: Darryl d'Sa <ddsa@rhsmith.umd.edu>
Subject: Number of PERL downloads
Message-Id: <36A8C649.758760DF@rhsmith.umd.edu>
I am a researcher studying the phenomenon of Open Source and Perl. am
interested in information on how the user base has grown over the years
possibly measured by the number of downloads.
Any leads on how i might obtain such information.
Thnx and rgds
Darryl d'Sa
------------------------------
Date: Fri, 22 Jan 1999 12:35:54 -0500
From: BELYAKOV_LEN <len.belyakov@inrange.com>
Subject: Perl editor ?
Message-Id: <36A8B6FA.DE80D6F0@inrange.com>
I'm playing with PerlBuilder (from soluctionsoft.com) and while it's
nice and better than nothing it's got some quirks and behaves annoying
at times. I'd buy it were it $40, but unfortunately it's $150. Does
anyone know of another IDE-type editor that's good for using Perl?
Thanks
Len
NB. My address in this message is a bogus one obviously--please post
your responses to the newsgroup.
------------------------------
Date: Fri, 22 Jan 1999 17:29:45 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: Perl problem :(Offline mode...
Message-Id: <KcYcTCAJWLq2EwAW@beausys.demon.co.uk>
In article <qm7687.feo.ln@magna.metronet.com>, Tad McClellan
<tadmc@metronet.com> writes
>
> Well then, let's share with you the point of these discussion groups.
>
> It is to discuss interesting Perl problems.
>
> Discussing problems that have already been solved is not interesting.
That's your view. The announcement e-mail that one receives when one
subscribes to the group says that ... "comp.lang.perl.misc is for
questions on the Perl language".
It doesnt say that questions have to be "interesting", nor that
questions that have been asked before cannot be asked again.
However, I have to say that I am utterly amazed at the amount of effort
that has gone into...
* haranguing me for posting questions that are (or may be) answered in
documentation
* telling me *why* I should bother to documentation (...as though I
never read a document in my life)
* making arrogant and highly patronising (and in some cases,
offensive) remarks
I am sure that this effort would have been much better spent in
providing an answer to my original question.
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: 22 Jan 1999 11:33:57 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: PROOF: Schwartz is LORD of the Transform!
Message-Id: <m1ww2fje56.fsf@halfdome.holdit.com>
>>>>> "Jerome" == Jerome O'Neil <jeromeo@atrieva.com> writes:
Jerome> @sorted_arr = map {$_->[0]}
Jerome> sort { $a->[1] cmp $b->[1] }
Jerome> map {[$_ , (split(',,', $_))[$index_to_sort_by]]}
Jerome> @arr;
Jerome> IT CANNOT BE DENIED!!!
The canonical ST always has map $_->[0] as the first element, and a
listref as the third, so at a slight loss of some symmetry, we could
reduce the brace count on this to:
@sorted_arr =
map $_->[0],
sort { $a->[1] cmp $b->[1] }
map [$_, (split(',,', $_)[$index_to_sort-by])],
@arr;
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Fri, 22 Jan 1999 18:33:20 GMT
From: mikeob@itas.netnospam (Gigatron)
Subject: read line by line in perl
Message-Id: <36aec38c.18957960@news.mtt.net>
How can I read a text file line by line in perl
read line one, dosomethoing read line 2 the do something and read line
three do something..
EX:
info>>this|is|some|info|
more>>thhis|is|more|info
more>>this|is|more|again
end>>this|is|the|end
The second line can appear many times, so I need to read the first
line and put that data into a scalar, then I need to reAZd the second
line, if the beggining of it starts with more>> then I will act
acordinagly. Then eventually the last line will be read and so
forth....
Giga
------------------------------
Date: Fri, 22 Jan 1999 14:08:07 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: read line by line in perl
Message-Id: <fl_aggie-2201991408070001@aggie.coaps.fsu.edu>
In article <36aec38c.18957960@news.mtt.net>, mikeob@itas.netnospam
(Gigatron) wrote:
+ How can I read a text file line by line in perl
+ read line one, dosomethoing read line 2 the do something and read line
+ three do something..
while not eof do begin
read file line
DoSomethingTo line
endwhile
In your case, I'll suggest 'Learning Perl', 2nd edition. Its blue, has
a llama on the cover. Then you can discover how to code the previous
pseudo-code into valid perl...
Or you can just simply read the documentation that came with your
distribution, if you don't want to spend $30 for a book.
James - actually, perl combines the read with the while statement, so its
a bit shorter than the pseudo-code
------------------------------
Date: Fri, 22 Jan 1999 19:08:51 GMT
From: josh@sequoiasoft.com
Subject: regular expression help
Message-Id: <78aibq$b3h$1@nnrp1.dejanews.com>
I'm trying to chop the .jpg or .gif extensions off a filename, in Perl
$afile = ($file =~ m:(.*)\\..*:);
$file is the filename of the picture, eg. Pic1-2.jpg
This returns an empty string. What am I doing wrong?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 14:29:59 -0500
From: Tom Renic <trenic@nortelnetworks.ca>
Subject: Replacing Carriage Returns with commas??
Message-Id: <36A8D1B7.9C743A58@nortelnetworks.ca>
I'm new to the field of cgi and perl so please forgive my naiveness. How
can parse a
carriage return and replace it with a comma? I need to setup a text file
that can inserted into an Excel worksheet so all of the information
gathered from the form (including the textareas) must be put into the
.txt file on a single line. Can some PLEASE help???
------------------------------
Date: Fri, 22 Jan 1999 19:09:57 +0000
From: Kevin Luff <kluff@enterprise.net>
Subject: SMTP / ESMTP modules
Message-Id: <36A8CD04.E1FB0B96@enterprise.net>
Hi....
I know , and have used the Net::SMTP modules OK for sending stuff,
but.....
is there anything out there that can do the reverse
that is , respond to incoming (E)SMTP requests and accept incoming stuff
?
Kevin
------------------------------
Date: 22 Jan 1999 19:11:12 GMT
From: lori@cse.ucsc.edu (Lori Flynn )
Subject: thanks
Message-Id: <78aigg$du1@darkstar.ucsc.edu>
>From lori@cse.ucsc.edu Fri Jan 22 11:10:00 1999
Date: Fri, 22 Jan 1999 11:09:45 -0800 (PST)
From: Lori Flynn <lori@cse.ucsc.edu>
To: Lori Flynn <lori@cse.ucsc.edu>
Subject: Re: deleting hash entries
Hi Rick,
Thanks for figuring out my hash problem! Also, the perldoc perlref lead
was a good place to go for more info, thanks again...
-Lori
------------------------------
Date: Fri, 22 Jan 1999 17:43:15 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: The Documeantion (was Re: Perl problem :(Offline mode...)
Message-Id: <882R7JAziLq2EwFK@beausys.demon.co.uk>
In article <slrn7agm54.nt0.sholden@pgrad.cs.usyd.edu.au>, Sam Holden
<sholden@pgrad.cs.usyd.edu.au> writes
>
>I can only dream of the day that people actually learn how to read manuals,
>and don't get into the habit of asking in newsgroups for everything. Of course
>if people keep answering them with more than a reference to the docs then it
>will never happen...
I spend half my life reading manuals. I also know that manuals dont
always tell you what you want to know.
However, I have to say that I amazed by this attitude. I guess that one
could, with such reasoning, answer 99.9% of all the questions that come
up on this newsgroup with the simple (and unhelpful) reply of "Read the
manual!".
Perhaps we need TWO newsgroups for queries concerning the Perl language.
One for us newbies, where we might expect to get a helpful response
(...other than the easy and convenient one of "Read the manual")
without all the "attitude" and patronising remarks, and another for the
"experts" who are so easily offended by the trivial questions posed by
us newbies.
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: Fri, 22 Jan 1999 18:14:12 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: Undefining $1 after regexp match
Message-Id: <78af58$866$1@nnrp1.dejanews.com>
In article <78a9du$2jf$1@nnrp1.dejanews.com>,
blakekr@my-dejanews.com wrote:
> *Very* dumb question here, but I can't find the answer in my books -- maybe my
> approach is wrong.
>
> I have a bunch of "source" documents that I need to open, parse and display.
> So the script needs to know which element is a byline, an article, a title,
> etc. The byline might show up before or after "title," though, and some
> fields won't exist in every article. So I'm pattern-matching separately for
> each, e.g.:
>
> $filestring =~ /selections\|([^\|]*)\|/;$selections = $1;
> $filestring =~ /bio\|([^\|]*)\|/; $bio = $1;
> $filestring =~ /author\|([^\|]*)\|/; $author = $1;
>
> The problem is, I don't know how to undefine $1 and its cousins after each
> pattern match (obviously, "undef $1" doesn't do it). Help?
You can't assign to $1 ... it's read only. But don't worry about it ...
just create conditionals for the assignments:
if ($filestring =~ /selections\|([^\|]*)\|/) { $selections = $1; }
if ($filestring =~ /bio\|([^\|]*)\|/) { $bio = $1; }
if ($filestring =~ /author\|([^\|]*)\|/) { $author = $1; }
You don't need the escape in front of the pipe in the character class
(if that's what that '\' was doing), and you probably don't need the '\|'
at the end of each regex. The part you are capturing ensures that it
will match up to the first pipe encountered, if one is there ... but maybe
you really only want to match if there is a trailing pipe?
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 19:00:34 GMT
From: "R. Alcazar" <alcazar@netcomp.net>
Subject: Writing files
Message-Id: <mV3q2.4415$oo2.588@news.flash.net>
Hello all,
I'm trying to do something quite simple... however, its got me stumped.
All I wanna do is open a file (thus, creating a new file) inside of a
directory store in my webserver. However, it fails and returns an error:
permission denied. Such that:
open(SOMEFILE, "/somedirectory/somefile.txt") || die "$!\n";
I've checked the file permissions, and the only way I can get it to
write to that directory is if I specify 777 on that directory. (Which is
obviously what I DON'T want to do). It seems that (at the very least) in
order for me to open/create a file inside that directory I need permissions
of 007. I wrote another script outside of my prog which does the same thing
and that seems to be working fine.
The prog with this problem is quite lengthly and I don't feel the need
to recode it. I haven't had any chmod functions or file operators anywhere
in the script and I don't know why it is returning "permission denied"
unless I specify 007. Any ideas why this is happening... any suggestions
are appreciated...
illfigah
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4723
**************************************