[8514] in Perl-Users-Digest
Perl-Users Digest, Issue: 2131 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 18 22:07:25 1998
Date: Wed, 18 Mar 98 19:00:33 -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 Wed, 18 Mar 1998 Volume: 8 Number: 2131
Today's topics:
.db becomes .dir and .pag with new perl version install cabel@panic.com
Re: .db becomes .dir and .pag with new perl version ins <zenin@archive.rhps.org>
Re: A Couple Questions (Craig Berry)
A Perl version of Crypt <swood@microsoft.com>
Re: A Perl version of Crypt <chasecreek.systemhouse@usa.net>
Re: compiling perl <chasecreek.systemhouse@usa.net>
Re: compiling perl (Greg Fruth)
Re: compiling perl <anthony@outshine.com>
Re: Date function - yyyymmdd format parkesb@yahoo.com
Re: Estimating connection speed? (David Oswald)
Re: Extracting HTML <TITLE>...</TITLE> using Perl? (Phil Hanna)
Re: How to emulate perl scripts with MSIE 4.0 and NT ? (Mike King)
Large integer keys in hash - perl5 <jerry.pendergraft@endo.com>
Memory allocation <marcels@informix.com>
minimum PERL installation??? <schaefer@adi.com>
odbc32 access of KSAM files <s027119@income.com.sg>
please help ... sending attachments via pop3 and perl CMT
problem with cperl-comment-region jason@cimedia.com
Reading POST data using PerlIIS <dontspamme-jeffh@castleweb-nospam-.com>
Re: removing everything between < and > <j.kiser@ix.netcom.com>
setuid and $0 <daftary@cisco.com>
Re: stripping "special" characters from string (Michael J Assels)
Re: Troubles "perl"ifying a shellscript that uses pipes <j.kiser@ix.netcom.com>
Re: ts: using "my" inside a loop? (Jason Gloudon)
Using perl code as a config file syntax? (Or, can requi <zenin@archive.rhps.org>
Re: Wanted: email address gleaner (to use for 'good' no <metcher@spider.herston.uq.edu.au>
Re: Wanted: email address gleaner <merlyn@stonehenge.com>
Webmasters?? <rbhattac@bayou.uh.edu>
Re: Where can I find perlman for perl/tk ? <pvhp@forte.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Mar 1998 19:41:57 -0600
From: cabel@panic.com
Subject: .db becomes .dir and .pag with new perl version install: why?
Message-Id: <6ept18$d35$1@nnrp1.dejanews.com>
Dear Perlers,
I'm currently running Perl 5.003_93, and whenever a perl script creates a .db
file (via dbmopen or whatever), it creates a "name.db" file.
However, after compiling and installing Perl 5.00404, I find that it creates a
"name.dir" and "name.pag" file instead.
I have tweaked and re-tweaked the makefile and the configuration to pull out
libraries and includes that I think related, to absolutely no avail. I'm very
stumped.
So my question is simple: how can I _define_ perl to use a .db file instead of
a .dir and .pag file during compile?
I'm doing this under Solaris 2.5 with a copy of Berkeley DB 1.85.
Thanks in advance for any help you can provide. (And please, if you can,
E-Mail me a copy of your answer to cabel@panic.com)
Best,
Cabel Sasser
Pa
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 19 Mar 1998 02:07:55 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: .db becomes .dir and .pag with new perl version install: why?
Message-Id: <890273661.723451@thrush.omix.com>
[ posted & mailed ]
cabel@panic.com wrote:
: I'm currently running Perl 5.003_93, and whenever a perl script creates a .db
: file (via dbmopen or whatever), it creates a "name.db" file.
I'd call that a bug in 5.003.93, unless you were explicate in
calling for the DB_File lib.
: However, after compiling and installing Perl 5.00404, I find that it creates a
: "name.dir" and "name.pag" file instead.
As it should, by default. See man AnyDBM_File for details on the
default lib search order.
>snip<
: So my question is simple: how can I _define_ perl to use a .db file instead of
: a .dir and .pag file during compile?
You can't, or at least shouldn't.
: I'm doing this under Solaris 2.5 with a copy of Berkeley DB 1.85.
At the start of your scripts, simply include the line:
use DB_File;
This will cause all calls to dbmopen() et al to default to using
the Berkeley database libs. Also, see man DB_File and man
AnyDBM_File for details.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: 19 Mar 1998 00:29:09 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: A Couple Questions
Message-Id: <6eposl$ihk$1@marina.cinenet.net>
Mikhail_82@yahoo.com wrote:
: What good will Perl do me if I learn it and what's it for?
It will allow you to write programs. In particular, it is well-suited to
writing two general types of programs: text manipulators, and
"shell-scriptish" glue programs. Since CGI apps consist mostly of text
manipulation, that's one common use to which Perl is put.
: Is it even worth all the time and energy to learn this language?
No. Not at all. It's far too much trouble. Should you need a Perl
program, it's almost certainly a far better idea to pay someone to write
it for you. Contact me for details.
[OK, OK, sorry. :-)]
: Some people told me its worth it, and others told me its not. Any
: opinions?
I personally find Perl to be an essential item in my programming toolbox.
It won't solve every problem (it's a terrible choice for, e.g., device
drivers, embedded apps, high-intensity number crunching, and so forth),
but it's *very* *very* good within the domains of text crunching and
systems 'glue', and entirely serviceable in many other domains as well.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Wed, 18 Mar 1998 16:19:12 -0800
From: "Stephen Wood" <swood@microsoft.com>
Subject: A Perl version of Crypt
Message-Id: <6epoa9$opk@news.microsoft.com>
Someone once posted a Perl version of crypt to this newsgroup. Could you
please repost?
--
The opinions expressed in this message are my own personal views
and do not reflect the official views of the Microsoft Corporation.
------------------------------
Date: Thu, 19 Mar 1998 00:37:47 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: A Perl version of Crypt
Message-Id: <35106783.CA258AAF@usa.net>
CRYPT is Built into Perl, no need to post it :-)
HTH,
Sneex :-)
Stephen Wood wrote:
> Someone once posted a Perl version of crypt to this newsgroup. Could you
> please repost?
>
> --
> The opinions expressed in this message are my own personal views
> and do not reflect the official views of the Microsoft Corporation.
------------------------------
Date: Thu, 19 Mar 1998 00:16:20 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: compiling perl
Message-Id: <3510627C.7025B42F@usa.net>
<Yikes!>
Sorry,
Sneex
Tom Christiansen wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> He's bad enough for asking, but you're rather worse for having
> given a false answer.
>
> --tom
------------------------------
Date: 19 Mar 1998 01:46:17 GMT
From: jetson@mustang.aero.org (Greg Fruth)
Subject: Re: compiling perl
Message-Id: <6eptd9$qt0@news2.aero.org>
In article <6epdcp$pbn$1@csnews.cs.colorado.edu>, Tom Christiansen <tchrist@mox.perl.com> writes:
>
> On rare occasion, the speed helps a wee bit, but nothing like fixing a bad
> algorithm or serverizing your model. If it's CGI we're talking, you're
> entirely barking up the wrong tree. And if you're into code-hiding,
> I just don't care to talk to you. :-(
What I would like a Perl compiler for is making a totally standalone,
easily deployable package. I want to install my app at a remote site (which
has a lot of restrictions on software installation), so in order to minimize
the footprint of my application (and installation difficulties for Joe User)
I would like to include only the parts of the Perl distribution that my
program needs. Is there a way to find out every bit of the Perl distribution
that my program uses (in all code paths)? This is further complicated by
Perl's ability to dynamically load bits of itself, and by the fact that
modules may load in code without me knowing it.
Including the entire Perl distribution (90% of which is unused by my program)
with my small application is a tremendous inconvenience. Also, it is
just begging for trouble because I don't have control over what goes on
at Joe User's remote site. If I could bundle up everything I need for my
program to run in one monolithic file (or even a few files) it would be very
helpful.
Is there a better way?
--
Greg Fruth (greg.fruth@aero.org)
The Aerospace Corporation
Los Angeles, CA
------------------------------
Date: 19 Mar 1998 02:33:44 GMT
From: Anthony Boyd <anthony@outshine.com>
Subject: Re: compiling perl
Message-Id: <6eq068$pem$1@news.ncal.verio.com>
In comp.lang.perl.misc Tom Christiansen <tchrist@mox.perl.com> wrote:
> The native-code perl2cc compiler does *not* make your program
> smaller in size,
> faster in run-time
> more portable,
> more maintainable,
> more secure,
> nor
> more robust.
>
> On rare occasion, the speed helps a wee bit, but nothing like fixing a bad
> algorithm or serverizing your model. If it's CGI we're talking, you're
> entirely barking up the wrong tree.
Tom, you ARE the expert -- I can see your books sitting on my bookshelf
above the computer. So, if what you say is true, then I am eager to hear
your thoughts:
Why is the Perl 5.005 release waiting for the promised compiler (supposed
to be out in November 1997) if it doesn't have benefits? Or are there
indeed benefits that just haven't been mentioned?
And if it does help with speed "a wee bit" why would that not help "if
it's CGI we're talking"? A CGI that gets 10 hits/second seems to me might
be the one place where even a wee bit would help. If you're thinking
optimizing your code would be a better speed improvement, wouldn't doing
both be the best speed improvement? Educate me.
You said if the original poster is into "code-hiding" then you don't even
want to deal with him. Is it possible that because you're opposed to
anything that inhibits free information, you're letting that sway you into
discounting other benefits of compilation that may indeed be real? I
don't mean that as a challenge -- if you come back and say that you've
tested betas of 5.005 and done speed tests and based on your inside track,
it really doesn't have any benefit at all, then I will believe that.
-Tony
------------------------------
Date: Wed, 18 Mar 1998 18:43:21 -0600
From: parkesb@yahoo.com
Subject: Re: Date function - yyyymmdd format
Message-Id: <6eppjt$8g8$1@nnrp1.dejanews.com>
I take your points and have, indeed, changed my script to use the POSIX
version. My excuse is that I am rather new to Perl and am still
learning the ins and outs.
Also, you must admit that I never said it was a good way to do it! :)
Brian
In article <890207629.918490@thrush.omix.com>,
Zenin <zenin@archive.rhps.org> wrote:
>
> parkesb@yahoo.com wrote:
> : One way to do it is:
> : chomp($portfoliodate = `date +%Y%m%d`);
> : which uses the unix date command to produce the right format.
>
> Don't ever do this...it's just the type of bad design that
> blows portability and reliability to hell for absolutely no good
> reason... Not to mention with the extra fork() needed to do this
> it can seriously slow some code down, as well as open up security
> holes and many other problems...
>
> --
> -Zenin
> zenin@archive.rhps.org
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 19 Mar 1998 00:05:44 GMT
From: doswald@xmission.com (David Oswald)
Subject: Re: Estimating connection speed?
Message-Id: <35105e55.66203888@news.xmission.com>
On Wed, 18 Mar 1998 15:30:38 -0600, Clinton Carr <ccarr@websocket.com>
wrote:
>Is there a simple way a Perl script can estimate the line connection
>speed? 14.4, 28.8, etc..
If you're suggesting that some amount of data be passed through a
connection while a timer is running you're not understanding how
modems work.
The following is an imcomplete list of factors that can affect the
speed at which a 100kb file is transmitted if the connection speed is
held constant (normalized out of the equation):
At the modem level:
* Error Correction Protocol
* Data Compression Protocol
* Byte length (stop bits, parity, etc.)
At the networking level:
* Packet style (TCP/IP, PPP, etc.)
* Number of layers of protocol.
* Software protocols (ie, FTP usually benefits from
various file transfer optimizations that are more
sluggishly implemented in favor of additional
functionality in other protocols, such as the
ICQ file transfer protocol, or the IRC DCC protocol.
* Network latency and lag (handshaking, network
bandwidth issues, server load, etc.).
At the file level:
* File's compressability.
* File's availability.
* Sending OS load.
At the communication level:
* Retrains
* Renegotiations
* Re-sent packets
Some of this may be a little redundant. The idea is that you can't
simply send a few thousand bytes across an arbitrary modem connection
and have a chance in hell of accurately estimating the connection's
DCE speed. What you CAN tell is how efficiently you are transmitting
the data, but you can't tell what speed the modem is connected at.
It's a little like asking if it's possible to determine how fast
someone is driving if it takes him a week to get from New York to San
Fransisco. Driving, of course, is only part of the trip; meal breaks,
restroom pit-stops, motel room stays, etc. also have a large effect on
the trip's duration, and make it nearly impossible to figure the
actual average driving speed unless you can first pin down how much
time was spent in all the other activities along the way.
Dave
------------------------------
Date: Thu, 19 Mar 1998 00:09:53 GMT
From: (Phil Hanna)
Subject: Re: Extracting HTML <TITLE>...</TITLE> using Perl?
Message-Id: <35106197.5885484@newshost.unx.sas.com>
On Tue, 17 Mar 1998 16:25:51 GMT, Matt Sephton <u5ms@csc.liv.ac.uk>
wrote:
>How would I go about extracting the HTML tag <TITLE>...</TITLE> using
>Perl? Would a regular expression suffice?
If you really need to dig into an HTML file and you need the solution
to be robust, you can use James Clark's nsgmls parser. It will very
accurately tokenize the HTML source and present you with an output
stream that you can more easily interpret. See
http://www.jclark.com/sp
----------
Phil Hanna
saspeh at unx dot sas dot com
------------------------------
Date: Thu, 19 Mar 1998 02:53:43 GMT
From: m.king.garbage@praxa.garbage.com.au (Mike King)
Subject: Re: How to emulate perl scripts with MSIE 4.0 and NT ?
Message-Id: <35108854.5800290@news.ozemail.com.au>
If you install IIS, and download perl for Win32, follow the
instructions, you should be able to run your CGI scripts locally. They
should run perfectly.
Good lusk,
Mike
On Thu, 19 Mar 1998 00:25:30 +0100, "Hello" <hello@hello.com> wrote:
>Can I emulate perl script with NT 4.0 and MSIE 4.0 (or another web browser)
>?
>Before uploading my script on an Unix computer, I should like to test it on
>NT 4.0
>
>Is it possible with FrontPage 98 beta 2 ?
>Is it possible with another software ?
>Where can I download it ?
>Thanks.
>
>
------------------------------
Date: Thu, 19 Mar 1998 02:47:04 GMT
From: Jerry Pendergraft <jerry.pendergraft@endo.com>
Subject: Large integer keys in hash - perl5
Message-Id: <35108729.A1F699C7@endo.com>
I recently ran across a strange behavior in perl5.
If one reads input consisting of numbers represented as:
0x0
0xffff
0x7fffffff
0x80000000
0x80000001
And uses the integer value, via hex(), any value large enough to be in
the unsigned integer range is not recognized. ala:
while(<>){
chop;
$n = hex($_);
$hash{$n}++;
}
print "0x0\n" if defined($hash{0x0});
print "0xffff\n" if defined($hash{0xffff});
print "0x7fffffff\n" if defined($hash{0x7fffffff});
print "0x80000000\n" if defined($hash{0x80000000});
print "0x80000001\n" if defined($hash{0x80000001});
Produces only:
0x0
0xffff
0x7fffffff
Perl v4p36 recognizes all and thus produces correct output.
Interesting clue is that if one defines the same values as:
%hash2 = ( 0x0, 1, 0x8000000, 1 ); # and others
then defined($hash2{0x80000000}) is true.
Possibly a glitch in hex(), or?
--
Jerry Pendergraft jerry.pendergraft@endo.com
Endocardial Solutions 612-523-6935
1350 Energy Lane, Suite 110
St Paul, MN 55108-5254
------------------------------
Date: Wed, 18 Mar 1998 17:22:06 -0800
From: Marcel Schaible <marcels@informix.com>
Subject: Memory allocation
Message-Id: <3510733E.43CF36E6@informix.com>
Hi,
I have written a c function (xs module) which reads a certain amount of
data from a file.
Something like this:
int
myread( conn, LO_fd, buf, nbytes)
CONNECTION *conn
int fd
char *&buf
int nbytes
CODE:
{
RETVAL = ex_read( conn, fd, buf, nbytes);
}
OUTPUT:
RETVAL
buf
In perl I want to allocate a nbyte large buffer which in turn is passed
into myread.
How can I allocate/free a buffer in Perl?
Thanks
Marcel
------------------------------
Date: Thu, 19 Mar 1998 00:39:56 GMT
From: Mike Schaefer <schaefer@adi.com>
Subject: minimum PERL installation???
Message-Id: <3510695C.75B0@adi.com>
Has anyone experimented w/a "minimum" PERL installation
(for DOS), which could run standalone on a 3.5 disk?
The only functionality that would be required would be
print STDOUT, read STDIN, and math (including transcendental
and trig functions)?
Thanks in advance for any assitance!
mvs
-------------------------------------------------------------------
Mike Schaefer (313) 973-1300 x220
Applications Engineer schaefer@adi.com
Applied Dynamics International www.adi.com
------------------------------
Date: Thu, 19 Mar 1998 10:16:15 +0800
From: "S. Sarkar" <s027119@income.com.sg>
Subject: odbc32 access of KSAM files
Message-Id: <6epv65$5i4$1@columbine.singnet.com.sg>
Hi,
Need help for the following:
what action can be coded in my Perl 5.001 script for notifying the ODBC
driver (running in IIS 3.0 in WIN NT) of a stop SQL select request on a HP
3000 KSAM file.
thanx
--
Shirshendu Sarkar
Singapore
Phone : 0065-330-1727
i am the newbie's newbie
------------------------------
Date: 18 Mar 1998 17:46:56 -0800
From: CMT
Subject: please help ... sending attachments via pop3 and perl
Message-Id: <6epteg$eea@drn.newsguy.com>
Hi,
I need help sending a attachment(s) via perl, I know how to send mail via perl
but not how to attach a file, could someone please explain.
Thank you much!
-CMT
------------------------------
Date: 18 Mar 1998 17:51:42 -0600
From: jason@cimedia.com
Subject: problem with cperl-comment-region
Message-Id: <85soofmub5.fsf@Taz.i-did-not-set--mail-host-address--so-shoot-me>
I recently upgrade to Emacs 20.2.1 and cperl-mode 2.6. When I try to
use cperl-comment-region (or comment-region) I get the following
error:
Args out of range: 1, 1
This function used to work before I upgraded.
--
Jason Bodnar
jason@cimedia.com
Internet Programmer
Cox Interactive Media -- Austin
------------------------------
Date: Wed, 18 Mar 1998 20:45:26 -0500
From: Jeff Hitchcock <dontspamme-jeffh@castleweb-nospam-.com>
Subject: Reading POST data using PerlIIS
Message-Id: <351078B6.5D311FF2@castleweb-nospam-.com>
It must be late and I must be short on caffeine. I am unable to figure
out how to read POST data using PerlIIS. Here's my code snippet:
read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
print $buffer;
When run as a standard Perl script, it works fine. Here's the output:
name=Name&email=Email&comments=Blah+Blah
When run under PerlIIS, I get nothing, even though printing
$ENV{'CONTENT_LENGTH'} shows a non-zero value.
How do I read form data submitted using POST?
------------------------------
Date: Wed, 18 Mar 1998 17:51:00 -0800
From: Jeffee Kiser <j.kiser@ix.netcom.com>
Subject: Re: removing everything between < and >
Message-Id: <35107A04.1B4C@ix.netcom.com>
jason@cimedia.com wrote:
>
> Yashesh Shroff <yashesh@eecs.berkeley.edu> writes:
>
> > hi all!
> > I have tried the perl documentation but was not able to find any source
> > for my following problem:
> > I would like to remove everything between '<' and '>' in a line and for
> > all the instances. I am trying to work out a script that basically
> > removes all the formatting tags in an HTML document. For the script:
> > -----------
> > $line = "This is <strong>strong</strong> and this is <b>bold</b> and
> > this is plain text.";
> > $line =~ s/<.+>//g;
> > print $line;
> > ----------------------------
> > I get the result:
> > This is and this is plain text <<notice that "strong" and "and this
> > is" and "bold" are also removed!
> > --------------------------------------------
> > everything between < and > is removed, however, if there is a second '>'
> > in the line, perl takes the largest instance of the match.
> > Anyway of making perl see the shortest instance of a match?
> > I cannot use the HTML module because it is not availabe on my university
> > system.
>
> use HTML::Parse;
>
> $line = q(This is <strong>strong</strong> and this is <b>bold</b>
> and this is plain text.);
> $line = parse_html($line)->format;
>
> --
> Jason Bodnar
> jason@cimedia.com
> Internet Programmer
> Cox Interactive Media -- Austin
Another solution without using the HTML::Parse package approach would be
to change your search and replace statement to this:
$line =~ s/<.+?>//g;
Remeber that '*' and '+' are greedy, in general, and will try to match
as much as possible; adding the '?' to the end of the regex tells it to
match a minimal number of characters
Jeff Kiser
j.kiser@ix.netcom.com
Design Engineer -- San Jose, CA
------------------------------
Date: Wed, 18 Mar 1998 17:28:39 -0800
From: "Kuntal M. Daftary" <daftary@cisco.com>
Subject: setuid and $0
Message-Id: <Pine.GSO.3.96.980318172423.4203F-100000@flipper.cisco.com>
hi
i use the following construct to get the name of the script file in most of my
perl scripts:
($self = $0) =~ s:.*/::;
recently i had to make a script setuid. and i realized that for setuid scripts
$0 is no longer the name of the script file. in my case it became /dev/fd/4.
or something like that.
also, for specifically this script, i really need to get the name of the script
file because i not only use it to set the $self but also stat the script to
find out group and user ownerships and perform certain authorization checks.
So any suggestions?
Kuntal Daftary
1.408.527.9789
daftary@cisco.com
------------------------------
Date: 19 Mar 1998 02:51:45 GMT
From: mjassels@cs.concordia.ca (Michael J Assels)
Subject: Re: stripping "special" characters from string
Message-Id: <6eq181$jn4$1@newsflash.concordia.ca>
In article <6eossn$47k$2@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, Randal Schwartz <merlyn@stonehenge.com> writes:
>:Syntax for list-splice is:
>
>ENOPEE
>
>: (LIST)[LIST_OF_INDICIES]
And of course,
EFEWEREYES
--
Michael Assels Comp. Sci. Concordia U. mjassels@cs.concordia.ca
------------------------------------------------------------------------
"O tempura! O morays!" -- Cicero, after dining on eels fried in batter.
------------------------------
Date: Wed, 18 Mar 1998 18:05:10 -0800
From: Jeffee Kiser <j.kiser@ix.netcom.com>
Subject: Re: Troubles "perl"ifying a shellscript that uses pipes
Message-Id: <35107D56.4960@ix.netcom.com>
Jonathan Rich wrote:
>
> I have been trying to "perl"ify a shellscript. The motivation is that
> I need to have the capability of floating-point math, whereas the
> shell I am using (bash) only does integer arithmetic. So for example,
> I may have a variable that has the value "5" and I want "5/2" to be
> 2.5 So I decided to switch to perl which of course has the math
> capabilities I am after. I thought all I would have to do is use
> perl's "system()" call, but have been running into great difficulty
> since it seems to have trouble w/ UNIX pipes. Take the following
> simple example and tell me how to do it:
>
> $n=5;
> system("echo This line has $n words | cat");
> This will work. Now suppose I want to interpolate in the value, $n+1.
> I try:
> system("echo This line has $n+1 words | cat");
> This doesn't work because of the quotes which prevent perl from doing
> the math I want. If I try to get rid of the quotes by making the
> system call into a list, there are problems w/ the "|" (pipe) which
> I haven't been able to figure out how to circumvent.
> From the reading I've done, it doesn't appear that the system function
> is really intended for pipes, but rather for a single command.
> Yet in the shell, pipes are commonplace and quite useful and I would
> certainly be disappointed if I can't use perl for my math while still
> getting done the things that I was using the shellscript for. My
> hope was that perl, w/ floating-point capability, would give me more
> flexibility than a shell but if I can't do pipes, I'll have to revert
> to the shell.
>
> Any advice or help will be greatly appreciated. Thanks.
>
> --
> Jonathan Rich
> rich@earth.nwu.edu
> Geoscience Dept.
> Northwestern Univ.
In regards to using pipes to carrying out system functions, I always use
the open command rather than system (e.g.):
open(ULINES, "grep 'some_pattern' file.txt | grep 'another_pattern'");
@lines = <ULINES>;
close(ULINES);
chomp(@lines);
Where, in this case, @lines is a list that will contain the results from
the two UNIX grep executions.
As far as any problems with interpolating arithmetic, you could try
using temporary scalar variables to store intermediate results and
interpolate those into the commands. This has always been fine for me
when converting both bash and csh scripts to Perl.
Jeff Kiser
j.kiser@ix.netcom.com
Design Engineer -- San Jose, CA
------------------------------
Date: Thu, 19 Mar 1998 02:04:33 GMT
From: jgloudon@bbn.subtleantispam.com (Jason Gloudon)
Subject: Re: ts: using "my" inside a loop?
Message-Id: <R2%P.27$x6.652824@cam-news-reader1.bbnplanet.com>
Jason Gloudon (jgloudon@manitoba.bbn.com) wrote:
: There really should be no substantial difference as the work associated
: with the maintenance of the lexical variables is the same in both examples.
: The lexical variables within a block are "created" only when execution enters
: that block. The for(each) loop enters and exits the { my () = split } block
: once, so the lexicals are still only "created" once.
: Jason Gloudon
I messed this up.
>From perlsub:
A my() has both a compile-time and a run-time effect. At
compile time, the compiler takes notice of it; the
principle usefulness of this is to quiet use strict
'vars'. The actual initialization is delayed until run
time, so it gets executed appropriately; every time
through a loop, for example.
So the original poster's idea is correct, placing the my variables within
the for loop does result in slower execution.
Jason Gloudon
------------------------------
Date: 19 Mar 1998 01:50:03 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Using perl code as a config file syntax? (Or, can require return more then one value?)
Message-Id: <890272589.444527@thrush.omix.com>
I'm trying to use a perl file as a config file. The file would look
something like this:
(
FOO => [ 'some', 'foo', 'options' ],
BAR => [ 'some', 'bar', 'options' ],
);
And be read with simply:
my %config = require 'some.config';
However, require doesn't seem to want to return a list value like this.
It will (and I've used many times) return a scalar of any kind, including
a sub ref which is why this works:
sub { return (
FOO => [ 'some', 'foo', 'options' ],
BAR => [ 'some', 'bar', 'options' ],
);
And be read with:
my %config = (require 'some.config')->();
While this does actually work, it seems there really, really must be a Better
Way[tm]. Is there any way to read a perl data stuct out of a file without
assigning it to a variable or using this sub ref kluge? -I'm tring to avoid
writing my own config code parser, because perl already does a much, much
better job of it then I could ever do. :-)
And no, I haven't really liked any of the config file modules at CPAN yet.
Most all of them seem to be far to much trouble to use, and/or vary limited.
Thanks!
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Thu, 19 Mar 1998 12:00:14 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Wanted: email address gleaner (to use for 'good' not spam!)
Message-Id: <35107C2E.36625BA2@spider.herston.uq.edu.au>
Jeff...look...<sigh>
This is like asking for a recipe for plastic explosive. Sure, there are
many and legitimate uses for plastique - but *nobody* in their right
mind is going to tell you how to make the stuff on *Usenet*.
Besides, you've munged your email address so many people aren't going to
be bothered to reply privately.
I sympathise, but...
--
Jaime Metcher
Jeff Potter wrote:
>
> ...Just thought I'd add that.
>
> I'm trying to make a book for a newsgroup based on its post archives.
> But I have to contact each poster and show them the post I want to
> reprint and ask permission. How to do this? It seems like an existing
> address gleaner would be a good start. Know of any?
>
> --
>
> Jeff Potter jp@glpbooks.BADMAIL.com delete '.BADMAIL' to reply
> ***"Out Your Backdoor": Friendly Magazine of DIY Adventure and Culture
> http://www.glpbooks.com/oyb ... with new bookstore & bulletin board
------------------------------
Date: 18 Mar 1998 17:41:25 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: jp@glpbooks.com
Subject: Re: Wanted: email address gleaner
Message-Id: <8ck99r3422.fsf@gadget.cscaper.com>
>>>>> "Jeff" == Jeff Potter <jp@glpbooks.BADMAIL.com> writes:
>> Sounds like SPAM to me.
[and me too.]
Jeff> Do you call posts from your mom spam, too? Please, give a reason
Jeff> as to why the above might be spam. ---It's a specific response
Jeff> to a specific post. It's *ontopic* to both the newsgroup and the
Jeff> specific posts involved.
No it's not. You aren't contributing to the topic. You're raping the
net. And on top of that, you're gonna fill *my* email box with a
question about permission to rape the net.
Lamer.
Looks like SPAM to me. Evil.
Just another guy fighting to preserve *your* precious resource,
--
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: Wed, 18 Mar 1998 18:38:03 -0600
From: Rishi Bhattacharya <rbhattac@bayou.uh.edu>
Subject: Webmasters??
Message-Id: <351068EB.3B43@bayou.uh.edu>
Hello,
I am currently starting a new project and I am looking for someone to
head the CGI section of my site. The project is www.webresource.net. It
will be a site for novice to expert webmasters. Please check out the
layout at:
http://www.webresource.net/
My team consists of experienced professionals, ranging from NASA
programmers to HP and DEC employees. The best candidate will have two
things : 1)Enough time per month to write at least two articles on the
topic of your choice (obviously has to do with perl/cgi) 2)At least a
years worth of cgi programming experience. If you are interested,
please email your resume and a few urls of your work to
rbhattac@bayou.uh.edu. Thank you for your time.
----
Rishi Bhattacharya
Electrical Engineer
NASA/Lockheed Martin
------------------------------
Date: Wed, 18 Mar 1998 17:27:00 -0700
From: Peter Prymmer <pvhp@forte.com>
To: apb.freddyb@mailexcite.com
Subject: Re: Where can I find perlman for perl/tk ?
Message-Id: <351003E4.181270FE@forte.com>
Alfred P. Bartholomai wrote:
>
> I am looking for perlman for perl/tk ? Does anyone know where I can
> find it.
>
> Thank you,
>
> Fred Bartholomai
>
> P.S. For those interested in perl on-line man pages see:
> http://www.ptk.bnl.gov/pod/index.html
There is the tkpod script that comes with Perl/Tk.
The Tcl -> Perl conversions of the manual pages are available in
the doc/ directory of the Tk build tree.
There is also a FAQ taking shape at: http://www.perl.com/ptk/ptkTOC.html
Hope that helps.
Peter Prymmer
pvhp@forte.com
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 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.
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 2131
**************************************