[6324] in Perl-Users-Digest
Perl-Users Digest, Issue: 946 Volume: 7
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 14 02:07:14 1997
Date: Thu, 13 Feb 97 23:00:18 -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 Thu, 13 Feb 1997 Volume: 7 Number: 946
Today's topics:
Re: "scalar each" - what does it mean? <tchrist@mox.perl.com>
Re: advise with require in perl5 (Nathan V. Patwardhan)
ANNOUNCE: GIFgraph 0.9 <mgjv@comdyn.com.au>
Re: case-insensitive grep()? (Dave Thomas)
Re: case-insensitive grep()? (Nathan V. Patwardhan)
Re: DBfile verses no DBfile (Geoffrey Hebert)
Re: DBfile verses no DBfile (Geoffrey Hebert)
Forcing Completion of System() Call <jlguru@cris.com>
GIF, JPEG scanning service. FREE OFFER! A pictures wor (Cyber Services)
Help w/ distributing perl app? (Aimee Schneider)
Re: How to open an HTTP connection with PERL ? (Terry D. Brashley)
Howto determine an object is a HASH or ARRAY <ltw@arraycomm.com>
Re: Match any char EXCEPT [char] (Dave Thomas)
Re: Need Perl Script to Telnet (Tim Bass )
Re: OK I know that I am a newbie But I need HELP!! (Nathan V. Patwardhan)
perl script bug (RKing)
Perl script debug help (RKing)
Questions about formline <rsk@cris.com>
Re: regex in context (Dave Thomas)
RFC: Statistics for comp.lang.perl.misc (Greg Bacon)
Re: search engines like infoseek (Geoffrey Hebert)
Re: upper to lowercase replace (Dave Thomas)
Re: upper to lowercase replace (Geoffrey Hebert)
Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Feb 1997 05:40:03 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: "scalar each" - what does it mean?
Message-Id: <5e0trj$gne$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
thomaso@best.com (Thomas Andrews) writes:
:My Perl 5 Camel book has the following code in the TIEHASH example
:(on pg 315):
:
: sub NEXTKEY {
: carp &whowasi if $DEBUG;
: my $self=shift;
: return scalar each %{ $self->{CONTENTS} };
: }
:
:For the life of me, I couldn't figure out what the "scalar" is doing
:here. I thought "each" returned a perl list of two elements - a
:key and value. And when you evaluate the list in "scalar" context
:it returns the number of elements, which would be 2 if we are still
:processing, and 0 otherwise.
:Am I missing something?
There is a logic error there:
1 each returns a list of two elements
2 when you evaluate a list as a scalar, you get its count
(actually, you usually get the last element of the
list; it's an array that gives you its count)
3 therefore each as a scalar is its count
That's invalid logic. There's no transitive property of
conversion here. You can *NEVER* go from point 1 to point
3 in perl . That's why it says
THERE IS NO GENERAL RULE FOR CONVERTING A LIST INTO A SCALAR!
So what each() does as a scalar is entirely up to it. You
may not, can not, and must not infer anything based on the
behaviour of anything else in the language. Yeah, from some
perspectives, this kinda sucks. But from others it's nice.
Which wins I'll let you decide.
:The doc on "each" in chapter 3 doesn't list
:anything special about how it evaluates in a scalar context...
I believe I wrote it that way to make sure it would only return
the key alone, which is what each() does as a scalar. The only
problem is that it's quite hard to distinguish an undefined key
from the end of the sequence. So in general, it's not a good
idea.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
if (shm == (char *)-1) /* I hate System V IPC, I really do */
--Larry Wall, from doio.c in the v5.0 perl distribution
------------------------------
Date: 14 Feb 1997 04:24:17 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: advise with require in perl5
Message-Id: <5e0pdh$foc@fridge-nf0.shore.net>
Bob Mariotti (rmariott@tiac.net) wrote:
: These subroutines function if included in their entirety without
: require and even with require, as seen in several examples, the
: subroutines end with 1; }
Your header file (library) should end with 1; , which means require will
return true for the file. Every subroutine, in turn, can be executed
from the header file.
--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"
------------------------------
Date: Fri, 14 Feb 1997 15:08:13 +1100
From: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: ANNOUNCE: GIFgraph 0.9
Message-Id: <3303E52D.1BDD@comdyn.com.au>
Hi all,
As promised before, I'm releasing the alpha version of GIFgraph. It's a
package to create GIF bitmaps displaying a graph. Currently supported:
pie, bar, lines, points, lines+points and area charts. It doesn't work
with numerical X data yet, just labeled data. You will need to install
Lincoln Stein's GD to use it.
I haven't submitted it to CPAN yet, but will do so as soon as my
registration comes through. Until then, it will be available from
http://www.tcp.chem.tue.nl/~tgtcmv/perl/
as
GIFgraph-0.90.tar.gz 14-Feb-97 04:09 15K
Module description:
Name DSLI Description
----------- ---- --------------------------------------------
GIFgraph:: Package to generate GIF graphs, uses GD.pm
::pie adpO pie graph
::bars adpO bar chart
::lines adpO line graph
::linespoints adpO lines and points graph
::points adpO points graph
::area adpO area graph
enjoy,
--
Martien Verbruggen
Webmaster www.tradingpost.com.au
Commercial Dynamics Pty Ltd, N.S.W., Australia
------------------------------
Date: 14 Feb 1997 04:30:07 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: case-insensitive grep()?
Message-Id: <slrn5g7qda.jgq.dave@fast.thomases.com>
On 13 Feb 1997 19:04:28 -0800, Kin Cho <kin@sampras.isi.com> wrote:
> There does not appear to be a way to grep() with case off.
> Am I missing something?
>
> By the way, [A-Za-z] isn't so great in what I'm trying to do.
my @lines = ('the Cat', 'SaT in', 'the hAt');
print join("\n", grep(/[ch]at/i, @lines)), "\n";
Dave
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 14 Feb 1997 04:26:31 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: case-insensitive grep()?
Message-Id: <5e0phn$foc@fridge-nf0.shore.net>
Kin Cho (kin@sampras.isi.com) wrote:
: There does not appear to be a way to grep() with case off.
: Am I missing something?
Try: grep(/whatever/i, $string);
--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"
------------------------------
Date: Fri, 14 Feb 1997 05:21:07 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: DBfile verses no DBfile
Message-Id: <5e0rva$g2i$1@news3.microserve.net>
tadmc@flash.net (Tad McClellan) wrote:
>Geoffrey Hebert (soccer@microserve.net) wrote:
>: Proplem: 50 online internet users using an application. Count each
>: application access by user. Each user has a user-id.
>: Everyone uses DBfile. But why?
>What if a user has _two_ instances of the app running? Multi-tasking
>brings concurrency control problems as does Multi-user.
>That may be disallowed by your access control, but you haven't said so...
I am trying to understand your response. If I only have one file and
multiple apps running then I do have concurrency problems. Solution
below avoids it.
>: Why not - Have an individual file for each user id with a count to
>: increment. Here I have a simple directory lookup, increment without
>: lock, open file, increment counter, write, and close. Simple with
>: minimal system resources.
>: I can see no reason not to do it this way, of course, I am new to
>: UNIX.
>: Now, how does it change as the volume goes up. Say, I have 30,000
>: users. Looks to me, that the individual file solution becomes even
>: more favorable. What do you think?
> ^^^^^^^^^^^^^^
>I don't think so. Can you have 30,000 filehandles all open at the same
>time on your system?
I'll only quickly open increment and close, the system resources will
limit number of users before I'll be able to have 30,000 concurrent
apps running.
>Want to have 30,000 files in the same directory? If not, then add in
>some more time for figuring what directory to look in.
I'll have a separate directory only with these types of files. 100,
1000, or 30,000, it will not matter.
>: email please heberts@microserve.net
>How come?
>--
> Tad McClellan SGML Consulting
> Tag And Document Consulting Perl programming
> tadmc@flash.net
------------------------------
Date: Fri, 14 Feb 1997 05:33:11 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: DBfile verses no DBfile
Message-Id: <5e0slu$gab$1@news3.microserve.net>
Todd Hoff <tmh@possibility.com> wrote:
>> Everyone uses DBfile. But why?
>For a 50 user solution files are just fine. But 30000
>files in one directory might be slow depending on the
>OS. Many unix OSs use in a linear search for looking
>up a file in a directory. At 30000 files this is a high
>hit. If your transaction rate is low this may
>not matter.
Yes, I can see where this might be slower with a linear directory.
>A way around this to use a deeper directory structure
>so fewer files end up in the leaf directories.
Does this mean to have a hiarchy directory structure?
>This approach
>works well on several levels. Assuming the files are text
>then humans can see and edit them. Flock works on files
>which are naturally there in this approach. It increases
>parallelism because you don't have to lock a single DBM
>file. And the access time will be small and constant.
I think you are saying that this is a good approach, at some point the
directory will get too large adn I should then break it into a hiarchy
of directories to reduce the delay in a linear search.
Is that right?
------------------------------
Date: Thu, 13 Feb 1997 21:22:55 -0700
From: "Jerry L. Gubka" <jlguru@cris.com>
Subject: Forcing Completion of System() Call
Message-Id: <3303E89F.4881@cris.com>
I am running Perl 5.001 under WinNT 4.0. My script repetitively executes
several system() calls to execute external programs that generate
Autocad DXF files, then executes Acad to import the DXF files, plot the
drawings to a file, save the drawing, end Acad, and run PKZIP to
cumulate the resulting drawings/deferred plot files.
My problem is that Perl does not execute the system() calls sequentially
(as in Win95). Rather, it blithely continues generating DXF files even
as Acad is striving to catch up and I end up with multiple instances of
Acad running simultaneously. That would be OK, but in the process some
temporary files get stomped over resulting in a mess.
My question is, how do I force Perl to wait for a system() call to
complete before continuing? I tried using wait() but received an
"unimplemented feature" error message.
I recall this question being asked here before, but I cannot find
references to those postings in either Dejanew or Alta Vista; and, I can
find no help in either the manpages or the online FAQ's.
Thanks in advance ...
Live long, and prosper
Jerry L. Gubka
------------------------------
Date: Thu, 13 Feb 97 22:38:37 GMT
From: scanning@XXX1324noreply.com (Cyber Services)
Subject: GIF, JPEG scanning service. FREE OFFER! A pictures worth a thousand words! (nfgHpJ)
Message-Id: <uYFro7fG8GA.155@uptgmsnb01>
Why don't you print or save this info in case you need it in the future?
Hello Friends,
It's time to take full advantage of the online medium by having your
photographs scanned today! Once your pictures are scanned into one of three
formats (GIF, JPEG, or BMP) you can do many exciting things with them.
-You'll easily be able to attach them to emails and send them to people
your chatting with online. No more having to try and explain what you look
like!
-You can also use your photos in all kinds of fun projects: build web
pages; design your own greeting cards; make personalized stationary,desktops,
and screen savers- the list is endless!
- Scan pictures of yourself, your pet, your vacation, or whatever you
choose!
Cyber Services will scan ANY photograph, drawing, magazine clipping, or
other artwork to an image file, and email or US mail it (on disk) back to you
within 24 hours of its receipt. (You must be able to receive file attachments
to get your file(s) via email. Check with your ISP if your not sure.) PRIVACY
& CONFIDENTIALITY ARE ASSURED. You'll also receive helpful technical tips on
everything from renaming your file to saving time when sending it to people
via email.
We scan all our images in 16.7 million colors for best quality. For just
$1 extra we can enlarge or crop your photo, blur out a body part, or ad text
(such as your name or email address).
Best of all, as a FREE GIFT to you (limited time only), IF YOU CHOOSE TO,
we'll reserve you a FREE PAGE (or pages) in our "Internet Date-Site" (Now
under construction!!!). This web site contains pages classified by local area
and sexual preference. There's also a erotic image gallery (must be legal age
to enter), and a "special interests" section. That's right, you can have your
own page on the internet for just $4! (Note: You're responsible for answering
your dog's email!) Your free page(s) will include any or all of the
following: Your scanned photo(s) (You pick which ones- You can have some, none
or all of your photos posted on your page), your email address with an icon
visitors can click to send you mail, and a brief profile about you. We'll
remove or modify your page, at your request, at anytime! When the "Date-Site"
opens for business, you'll receive an email notifying you of the address of
your personal web page. You can give the address to people and they can view
it from any internet
connection! There are millions and millions of people on the internet.It's
time you start meeting them! (This service won't be free for long so act
now!)
If you have any questions regarding our services, please call us at
(541)744-5718.
Ordering Information:
Price: $4 for first scan, $3 for each additional scan
Extras: $1 each to add personalized information. (name/email)
$1 each to have image modified (enlarged, body part blurred,
etc.. )
$2 to have image files mailed to you on a floppy disk (IBM or
MAC).
$1 credit card processing fee (Visa/Mastercard users only)
If you would like your photographs returned to you please include a self
addressed stamped envelope. Otherwise they will be destroyed.
Order Form (PRINT OUT or COPY CLEARLY):
Name (optional):
Email Address or Screen name (PRINT CLEARLY! You must be able to receive file
attachments. Otherwise include $2 for shipment on floppy disk.):
Address (optional unless having shipped on disk):
Phone number (optional):
File type (GIF, JPEG, or BMP. GIF recommended):
Extras (Exact personalized info you want printed on scan):
Disk Format (if having mailed on a floppy): IBM or MAC
Payment method (Cash, Check, Money Order, or Visa/Mastercard):
Please make checks payable to Cyber Services.
Credit Card # (credit card orders only):
Expiration date:
Don't forget to include the $1 processing fee if your paying with your credit
card.
Do you want the FREE GIFT? Yes or No (circle one)
-Web Page(s) in our "Internet Date-Site" (under construction). You can
have a page for yourself, a page for your car, and a page for your cat! Be
sure to indicate where you want your page (F4M, M4F, F4F, F4M, or Couples) and
which of the following info you want on your page (print clearly): State and
Town, email address, year or birth, physical description, quote/message
(under 30 words please). Please indicate which photos you want on your page
(if any) if you don't want them all to be displayed. If your want your
nude/erotic photos displayed in our erotic image gallery YOU MUST include a
signed statement that your are over 18 years of age or older and give us
consent to display your nude/erotic photo, and be sure to tell us if your
want it displayed with your info or anonymously.
Mail the above information and photos with payment to:
Cyber Services
2852 Willamette St. #131
Department 1
Eugene, OR 97405
Orders sent overnight will be given first priority.
Erotic/Nude photo's will be accepted providing everyone in them is of legal
age.
Questions? Call (541)744-5718
Please help our small business grow by sharing this info with someone you
think could use it.
Thank You!
(nfgHpJ)
------------------------------
Date: 14 Feb 1997 06:23:08 GMT
From: aimee@interport.net (Aimee Schneider)
Subject: Help w/ distributing perl app?
Message-Id: <5e10cc$2mr@park.interport.net>
Hey all,
Has anyone out there written a commercial app, or parts thereof, in perl
and distributed it? My problem is that I want to distribute this app, but
not the source. I know, it shouldn't have been written in perl in the
first place, but it's too late to rewrite it now. From what I understand,
my options are (from the FAQ, Q3.5):
1. Obfuscate it
2. Use cryptswitch()
3. Include a disclaimer at the top of each file
or
4. Use the perl compiler to turn it into C or bytecode
Options 1 and 3 are pretty much out of the question. I tried using the
perl compiler and actually had a little success. The problem: it worked
(bytecode) on sparc, but it needs to work on NT. I'm going to spend
another day trying to port it (the compiler) but it's giving me a real
headache.
Now... I'm interested in cryptswitch(), but I didn't see any
documentation for it. It's only briefly mentioned in the 'Changes' file
that comes with the source dist. Anyone have any info on this?
Also, anyone ever use the Filter module?
I'm running out of options and am kind of in a bind, so ANY
help/suggestions would be GREATLY appreciated.
thanks!
-Aimee
------------------------------
Date: Fri, 14 Feb 1997 05:28:54 GMT
From: brashley@worldnet.att.net (Terry D. Brashley)
Subject: Re: How to open an HTTP connection with PERL ?
Message-Id: <3303f7a2.99714866@netnews.worldnet.att.net>
On 13 Feb 1997 20:17:13 GMT, nvp@shore.net (Nathan V. Patwardhan)
wrote:
>Mihai Crasneanu (mihaic@usa.net) wrote:
>I presume that working a project requires research, in which case I'll help
>you research your topic: Check out http://www.dejanews.com and query for:
Nathan - arrogance is ignorant, and I presume (?) you're not. Be nice
- folks come here for help. If you can't help civily - don't!
I DO appreciate your "pointers".
TerryB
------------------------------
Date: Fri, 14 Feb 1997 04:01:49 GMT
From: Loh Thiam Wah <ltw@arraycomm.com>
Subject: Howto determine an object is a HASH or ARRAY
Message-Id: <3303E3AD.2781E494@arraycomm.com>
Hi, As you all know an object data member can be implemented using HASH
or ARRAY. But how can you tell during runtime after the blessing , if it
is a HASH or ARRAY ?
Thanks all,
ltw
--
Loh Thiam Wah
Address:
ArrayComm, Inc.
3141 Zanker Road
San Jose, CA 95134
USA
Homepage : http://www.arraycomm.com
(408) 952-1913 Direct voice
(408) 428-9080 ArrayComm general number
(408) 428-9083 fax
Email : ltw@ArrayComm.COM
------------------------------
Date: 14 Feb 1997 04:13:08 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Match any char EXCEPT [char]
Message-Id: <slrn5g7pdf.jgq.dave@fast.thomases.com>
On Thu, 13 Feb 1997 19:23:35 -0600, Augusto Roman <aroman@nmsu.edu> wrote:
> Hello! :)
>
> In a program I'm working on, I need to search through a string and match
> a pattern that contains any character except one specific char. Can
> this be done?!
>
> I seem to remember reading about this in a book, but I no longer have
> access to this book.
>
> I've searched the FAQ and the programming reference, but I can't seem to
> find it anywhere! It's possible (likely, even) that I'm simply too
> brain-dead at this point to see it, but I've looked quite a bit.
Look again at 'perlre', specifically at character classes and the caret
character.
Dave
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 14 Feb 1997 05:55:49 GMT
From: bass@cais.cais.com (Tim Bass )
Subject: Re: Need Perl Script to Telnet
Message-Id: <5e0up5$qa8@news2.cais.com>
Okay.... here is one example telneting to the weather underground....
I just hacked this out, but you should get the idea.
USAGE: perl filename downwind.sprl.umich.edu 3000
Tim
-----
#!/usr/bin/perl
# quick hack to weather underground as example of telnet
# session with perl
# hacked by bass@silkroad.com (not a perl expert :)
# as an example answer to question
# use at your own risk.....
$ConnectionOpen = 0; # used by OpenConnection
$Server = "S";
$HOST = $ARGV[0];
$PORT = $ARGV[1];
&OpenConnection($HOST,$PORT);
while(recv($Server, $buf, 2048,0)){
$_ = $buf;
# hardcoded in the airport 'wbc' -- DON'T DO LIKE ME ;)
if(/Press Return/){send($Server,"wbc\n",0);next;}
elsif(/Selection:/){
send($Server, "X\n",0);
sleep 2;
&CloseConnection($HOST,$PORT);
}
elsif(/\*/ || /^--/){next;} else {print ;}
}
# from the camel book client.pl
sub OpenConnection {
local($host,$port) = @_;
local($sockaddr,$name,$aliases,$type,$len,$that,$thataddr,$proto);
local($thishostname,$this,$thisaddr);
local( $AF_INET, $SOCK_STREAM ) = ( 2, 1 );
if ( $ConnectionOpen ) {
print STDERR "\nConnection already open---can't reopen!\n";
return -1;
}
$sockaddr = 'S n a4 x8';
chop($thishostname = `hostname`);
$Server .= "$$";
($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$proto) = getservbyname($port,'tcp') unless $port =~ /^\d+$/;;
($name,$aliases,$type,$len,$thisaddr) = gethostbyname($thishostname);
($name,$aliases,$type,$len,$thataddr) = gethostbyname($host);
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);
socket($Server,$AF_INET,$SOCK_STREAM,$proto) || die "socket: $!\n"; # Make the socket filehandle
bind($Server, $this) || die "bind: $!\n"; # Give the socket an address
connect($Server,$that) || die "connect: $!\n"; # Call up the server
select($Server); $| = 1; select(STDOUT); # set socket to be command buffered
print STDERR "\nopened server named '$Server'.\n" if $opt_d;
return 0;
}
sub CloseConnection {
local($host,$port) = @_;
print STDERR "Closing server $Server...\n" if $opt_d;
print $Server "q\n\n";
$ConnectionOpen = 0;
}
------------------------------
Date: 14 Feb 1997 04:22:00 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: OK I know that I am a newbie But I need HELP!!
Message-Id: <5e0p98$foc@fridge-nf0.shore.net>
Aaron-Technical Support (aaron@longsword.com) wrote:
: I totally blew my buffer today. My boss saw me reading "Learning Perl" and
: asked me to write a script. OK, no prob; I wrote a functional script. It
: uses `grep blah blah blah` to look up some info in six different error
Well, let's see some code. I presume you're parsing it somehow, right?
It's *impossible* for us to know what you're doing if you don't include
anything for us to analyze.
--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"
------------------------------
Date: Thu, 13 Feb 1997 14:31:20
From: rking@thepoint.net (RKing)
Subject: perl script bug
Message-Id: <rking.29.000E861A@thepoint.net>
Hello,
I'm running a perl script on unix under perl 4.036 and I can't figure this out.
This is the message I keep getting when I run ./ in unix:
Literal @thepoint now requires backslash at ./wilma line 217, within
string Execution of ./wilma aborted due to compilation errors.
@thepoint is part of my e-mail.
Literal @thepoint now requires backslash at ./wilma line 217, within
string Execution of ./wilma aborted due to compilation errors.
# heres the code, it's my e-mail addy:
<ADDRESS>
<A HREF=mailto:"rking@thepoint.net">rking@thepoint.net</A>
</ADDRESS>
Can anyone tell me why I'm getting this error msg?
I don't know if I posted enough info, but help would be MUCH appreciated.
RKing
------------------------------
Date: Thu, 13 Feb 1997 14:07:38
From: rking@thepoint.net (RKing)
Subject: Perl script debug help
Message-Id: <rking.28.000E20FA@thepoint.net>
Hello,
I found this in the faq:
3. Are you using the following?
#!/usr/bin/perl -w
use diagnostics;
use strict;
"-w" turns on all sorts of warnings about probable errors (see the
perldiag manpage), "use diagnostics" causes the "-w" warnings to be
explained in greater detail (with the explanations from the perldiag
manpage), and "use strict" generates compile and run-time errors for
certain unsafe variable, reference and subroutine constructs (see the
strict manpage)
I went and put it in at the top of my script, just as it apears
above. THEN when I do ./program, I get a message that says "no such file or
directory" Am I using it wrong? I'm using unix and perl v. 4. (036
I think).
Thanks in advance for any advice.
RKing
------------------------------
Date: Thu, 13 Feb 1997 16:43:13 -0500
From: "Robert S. Kissel" <rsk@cris.com>
Subject: Questions about formline
Message-Id: <33038AF1.41C6@cris.com>
The following code fragment:
formline 'Text: ^' . ('<' x $L) . "\r\n", $Text;
formline '~~ ^' . ('<' x $L) . "\r\n", $Text;
did not do what I wanted, and produced an $^A something like
Text: ABC ABC ...
~~ <<<DEF DEF ...
But when I assigned the PICTURES to variables:
$format[0] = 'Text: ^'.('<'x$L)."\r\n";
$format[1] = '~~ ^<<<'.('<'x$L)."\r\n";
formline $format[0], $Headline;
formline $format[1], $Headline;
things suddenly worked as I had expected, i.e., a hanging
paragraph:
Text: ABCDSRESDFS...
ASDFASDFASDFAS...
ASDSAFDASFSFAS...
. . .
This is Perl v. 5.003. I don't understand why this corrects the
incorrect output I was getting. I would also like someone who DOES
understand the following remark (in the description of formline in
the blue Camel Book) to restate it in words I can get through my
thick skull:
"...the formline function itself doesn't care how many
newlines are embedded in the PICTURE. This means that
the ~ and ~~ tokens will treat the entire PICTURE as
a single line." [p. 169]
I'd welcome a code-fragment example to demonstrate this behavior,
because I don't think I follow the point the authors were trying
to make.
Thank you for your kind attention.
------------------------------
Date: 14 Feb 1997 04:07:57 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: regex in context
Message-Id: <slrn5g7p3l.jgq.dave@fast.thomases.com>
On Thu, 13 Feb 1997 16:34:31 -0800, Michael Stearns <mstearns@darkwing.uoregon.edu> wrote:
> I have many .html pages with "same-page" links that look like:
>
> <a href = "#Setting Up procmail">Setting Up procmail</a>
>
> I want all these to look like:
>
> <a href = "#Setting_Up_procmail">Setting Up procmail</a>
>
One way is to use the /e modified to substitutions - that lets you nest
another substitution within the replacement pattern of the first. For example:
$ip =~ s!(<a href\s*=\s*"#)(.*?)">!
my ($x,$y) = ($1,$2);
$y =~ s/ /_/g;
$x . $y . '">'
!egs;
Substitutes the <a ...> clause. For each match, it saves the value of the
two portions of the clause (the '<a href = "#' and the stuff up the the next
'"' in local variables (so the upcoming s/// won't clobber them), then
replaces spaces on the second sub-match with underscores. The result of the
block is then substituted back into the original s!!!.
Note the '/s' modifier - I'm assuming you've read the entire page into a
scalar, so that we can cope with <A..>'s that span lines.
Regards
Dave
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 14 Feb 1997 05:33:56 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: RFC: Statistics for comp.lang.perl.misc
Message-Id: <5e0tg4$gub@info.uah.edu>
[Please mail me any comments, questions, suggestions, etc.]
Following is a summary of articles spanning a 7 day period,
beginning at 06 Feb 1997 04:43:09 GMT and ending at
13 Feb 1997 09:05:36 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^(?:>|:|\S+>)/.
- All text after the last cut line (/^-- \n/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" e-mail address and name.
Totals
======
Total number of posters: 447
Total number of articles: 913
Total number of threads: 381
Total volume generated: 1592.4 kb
- headers: 550.9 kb
- bodies: 968.0 kb (757.2 kb original)
- signatures: 71.4 kb
Averages
========
Number of posts per poster: 2.0
Number of posts per thread: 2.4
Message size: 1786.0 bytes
- header: 617.9 bytes
- body: 1085.6 bytes (849.2 bytes original)
- signatures: 80.1 bytes
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
53 59.9 ( 30.1/ 29.8/ 21.4) Nathan V. Patwardhan <nvp@shore.net>
36 57.8 ( 21.2/ 28.4/ 15.6) Dave@Thomases.com
36 62.8 ( 20.9/ 41.9/ 23.1) Tad McClellan <tadmc@flash.net>
34 60.1 ( 22.8/ 31.1/ 22.4) Tom Christiansen <tchrist@mox.perl.com>
28 58.3 ( 15.3/ 34.2/ 24.9) mike@stok.co.uk
28 38.7 ( 14.7/ 20.7/ 5.9) Jim Anderson <jander@jander.com>
26 37.1 ( 20.2/ 16.8/ 12.7) Tom Phoenix <rootbeer@teleport.com>
14 28.9 ( 7.8/ 21.1/ 17.4) nelson <nmljn@wombat.staff.ichange.com>
9 15.9 ( 5.7/ 9.5/ 4.8) Russ Allbery <rra@cs.stanford.edu>
9 10.8 ( 5.6/ 5.2/ 2.6) Ilya Zakharevich <ilya@math.ohio-state.edu>
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
154.2 ( 0.6/153.6/149.3) 1 hunter be hunted <sisiyang@wam.umd.edu>
62.8 ( 20.9/ 41.9/ 23.1) 36 Tad McClellan <tadmc@flash.net>
60.1 ( 22.8/ 31.1/ 22.4) 34 Tom Christiansen <tchrist@mox.perl.com>
59.9 ( 30.1/ 29.8/ 21.4) 53 Nathan V. Patwardhan <nvp@shore.net>
58.3 ( 15.3/ 34.2/ 24.9) 28 mike@stok.co.uk
57.8 ( 21.2/ 28.4/ 15.6) 36 Dave@Thomases.com
38.7 ( 14.7/ 20.7/ 5.9) 28 Jim Anderson <jander@jander.com>
37.1 ( 20.2/ 16.8/ 12.7) 26 Tom Phoenix <rootbeer@teleport.com>
29.8 ( 5.3/ 11.7/ 6.5) 8 Patrick Duff <pduff@airmail.net>
28.9 ( 7.8/ 21.1/ 17.4) 14 nelson <nmljn@wombat.staff.ichange.com>
Top 10 Threads by Number of Posts
=================================
Posts Subject
----- -------
18 ANNOUNCEMENT: Perl documentation and FAQ discontinued
16 Perl vs Korn Shell
11 Loops in perl
10 How to do this using perl?
10 Using exec-Why won't this work?
8 Need help - just starting perl
8 How to tell if Perl is run in debug mode
8 Using $ENV{'QUERY_STRING'}
8 on the fly graphs
7 Perl rand() function on solaris SPARC
Top 10 Threads by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Subject
-------------------------- ----- -------
154.2 ( 0.6/153.6/149.3) 1 perl
24.1 ( 11.4/ 11.5/ 6.3) 18 ANNOUNCEMENT: Perl documentation and FAQ discontinued
23.1 ( 10.5/ 11.5/ 8.2) 16 Perl vs Korn Shell
16.8 ( 4.4/ 12.2/ 4.9) 8 Need help - just starting perl
16.7 ( 7.0/ 8.9/ 6.2) 10 How to do this using perl?
16.5 ( 7.2/ 8.2/ 5.4) 11 Loops in perl
14.7 ( 7.0/ 7.0/ 5.1) 10 Using exec-Why won't this work?
14.2 ( 2.4/ 11.9/ 5.6) 4 Matt's Script: SSI Random Banner Generator
13.8 ( 4.6/ 8.7/ 4.8) 8 on the fly graphs
13.8 ( 4.5/ 8.3/ 3.6) 6 DNS lookups in perl
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
24 comp.lang.perl.modules
8 comp.lang.perl.tk
5 ford.comp.www
5 ford.comp.lang.perl
4 perl.porters-gw
4 comp.lang.perl
4 comp.databases.sybase
3 alt.online-service
3 comp.misc
3 comp.publish.prepress
Top 10 Crossposters
===================
Articles Address
-------- -------
8 Tony Ellison <ellison@ingress1.murdoch.edu.au>
4 Stijn van Dongen <stijnvd@cwi.nl>
4 Chris Nandor <pudge@pobox.com>
3 Mark Peskin <mpeskin@mail.utexas.edu>
3 "Sriram Srinivasan." <sriram@sirius.com>
2 john smith <john@jssm.demon.co.uk>
2 Thomas J. Forbes <tforbes@ix.netcom.com>
2 lawrence@research.nj.nec.com
2 Tom Phoenix <rootbeer@teleport.com>
2 Yan Lau <ylau@iworks.InterWorks.org>
------------------------------
Date: Fri, 14 Feb 1997 05:45:57 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: search engines like infoseek
Message-Id: <5e0tdr$gjh$1@news3.microserve.net>
przec@westminster.ac.uk (David Waters) wrote:
>I was wondering if anyone could tell me how the search engines
>on the web work with regard to only displaying 10 search matches
>at a time.
>What I am doing is writing a search engine for a client that brings
>back data from their catalog.
>The client now wants me to only display 10 at a time.
There are as many ways to do this as there are programmers.
Person requests information - Contacts in Reno
You respond with the first ten answers and a hidden file with the
original search request and a starting location, with a continue
button.
Conctacts in Reno 1-10
1..
...
10
Form mysearch.cgi
hidden Start_is "Contacts in Reno"
hidden Skip_is "10"
submit:
Perl and HTML work together
------------------------------
Date: 14 Feb 1997 04:24:32 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: upper to lowercase replace
Message-Id: <slrn5g7q2q.jgq.dave@fast.thomases.com>
On 14 Feb 1997 03:07:13 GMT, Michael Paul Stearns <mstearns@darkwing.uoregon.edu> wrote:
>
> I am trying to do a search and replace that involves changing an uppercase character to a lowercase.
>
> Right now I have :
> $text=~ tr^(<a href = \"\#)A-Z(\w+.*?\")^\1a-z\2^s;
>
> But this doesn't work.
>
> Any idea what I am doing wrong?
That's not what translate (tr) does. tr does a character by character
replacement. What you probably want is a substitution:
$text =~ s/(<a href = "#)([A-Z])(.*?)"/$1\L$2\E$3/g;
Its in 'perlre'
Regards
Dave
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Fri, 14 Feb 1997 05:56:24 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: upper to lowercase replace
Message-Id: <5e0u1f$gjh$2@news3.microserve.net>
mstearns@darkwing.uoregon.edu (Michael Paul Stearns) wrote:
>I am trying to do a search and replace that involves changing an uppercase character to a lowercase.
>Right now I have :
>$text=~ tr^(<a href = \"\#)A-Z(\w+.*?\")^\1a-z\2^s;
>But this doesn't work.
>Any idea what I am doing wrong?
Use the function uc().
It was designed to return upper case.
------------------------------
Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Jan 97)
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.
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.
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 V7 Issue 946
*************************************