[9652] in Perl-Users-Digest
Perl-Users Digest, Issue: 3246 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 24 14:07:24 1998
Date: Fri, 24 Jul 98 11:00:31 -0700
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, 24 Jul 1998 Volume: 8 Number: 3246
Today's topics:
...experienced Perl programmers rarely use eof... (Jordan Henderson)
Re: ...experienced Perl programmers rarely use eof... <merlyn@stonehenge.com>
??? set a local env var in perl script <wangli@nortel.ca>
Re: ??? set a local env var in perl script (Larry Rosler)
A question about taint (Marc Haber)
Re: Code showing apparent "Perl While Bug" <jdw@dev.tivoli.com>
Re: comparing files in perl <jdporter@min.net>
confused with list of hashes. <alexb@sig.net>
Re: confused with list of hashes. <jdporter@min.net>
Re: Date Question... <perlguy@inlink.com>
Re: Date Question... (Larry Rosler)
Re: extracting price from string (M.J.T. Guy)
Fetch problem with Oraperl <mspring@nortel.com>
File::Path::rmtree and Taint (Marc Haber)
free Perl books online <nonspammers.cut.after.the.period.hot_redox@hotmail.com>
Re: future date in epoch time rsnell@my-dejanews.com
Re: HELP! Hash of refs to objects <jdf@pobox.com>
Re: how do you extract information from a cgi page? <dean@mail.biol.sc.edu>
Re: How to know the number of hash items without runnin <dgris@rand.dimensional.com>
Re: Perl Beautifier Home Page <jdporter@min.net>
Re: Perl Beautifier Home Page <jdporter@min.net>
Re: Perl Beautifier Home Page <jdporter@min.net>
Re: Perl Beautifier Home Page <zenin@bawdycaste.org>
Re: perlfaq <perlguy@inlink.com>
Re: perlfaq <jeff.stampes@xilinx.com>
Re: Returning values from a child process <cbero@uwyo.edu>
Re: spss file format <earlw@kodak.com>
Re: Text processing question <jdporter@min.net>
Unable to make Perl? <josephs@fenix2.dol-esa.gov>
Re: Why can't I "require" a file? <jdf@pobox.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Jul 1998 11:46:10 -0500
From: jordan@Starbase.NeoSoft.COM (Jordan Henderson)
Subject: ...experienced Perl programmers rarely use eof...
Message-Id: <6padoi$7qq$1@Starbase.NeoSoft.COM>
On page 161 of the Camel book (2nd Edition, Sept. 1996) there is this
statement:
... In fact, experienced Perl programmers rarely use eof,
since the various input operators already behave quite
nicely in while-loop conditionals.
Now, I'm far from an experienced Perl programmer. However, is
there some neat programming trick that I'm missing? I do things
like process a file up to where a certain string is found, and
then change the processing until another string is
found and then change again. I find eof invaluable in these
situations for error checking the format of the file.
For example, say I want to extract preformatted text from an HTML
file. Note that this is not a general purpose preformatted-text-
extractor, but it's handy for files where I can guarantee the
format (in a case where I wrote the original HTML file with another
program, for example):
while (<HTMLFILE>) {
last if /^<PRE>/;
}
if (eof) die "HTML format bad, couldn't locate preformatted text.";
while (<HTMLFILE>) {
last if /^</PRE>/;
print;
}
if (eof)
die "HTML format bad, couldn't locate end of preformatted text.";
Is there a better, clearer way to do this sort of thing? With my (very)
limited knowledge and experience with Perl this seems straightforward,
clear and easy-to-maintain. It's also a really common kind of thing to
do (scan up to you find a string, process a block of text which has some
string that signals the block's end). What do experienced Perl programmers
do? I've seen the same sort of thing done with flags (crude state-machines),
but the above seems better.
A more general question, where can we inexperienced Perl programmers see
lots of good idioms in use? I know, I know, there's lots of code out
there on the net to mine, but can anyone recommend especially good
sources (other than the Camel book, of course)?
-Jordan Henderson (recovering tcl programmer)
jordan@neosoft.com
------------------------------
Date: Fri, 24 Jul 1998 17:31:54 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: ...experienced Perl programmers rarely use eof...
Message-Id: <8csojrm9z1.fsf@gadget.cscaper.com>
>>>>> "Jordan" == Jordan Henderson <jordan@Starbase.NeoSoft.COM> writes:
Jordan> For example, say I want to extract preformatted text from an HTML
Jordan> file. Note that this is not a general purpose preformatted-text-
Jordan> extractor, but it's handy for files where I can guarantee the
Jordan> format (in a case where I wrote the original HTML file with another
Jordan> program, for example):
Jordan> while (<HTMLFILE>) {
Jordan> last if /^<PRE>/;
Jordan> }
Jordan> if (eof) die "HTML format bad, couldn't locate preformatted text.";
Jordan> while (<HTMLFILE>) {
Jordan> last if /^</PRE>/;
Jordan> print;
Jordan> }
Jordan> if (eof)
Jordan> die "HTML format bad, couldn't locate end of preformatted text.";
Jordan> Is there a better, clearer way to do this sort of thing?
I usually write something like this:
$found = 0;
while (<FILE>) {
$where = /<PRE>/../<\/PRE>/;
$found = 1, print if $where;
last if $where =~ /E/;
}
die "we didn't find it!" unless $found;
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: 24 Jul 1998 15:26:50 GMT
From: "Liming Wang" <wangli@nortel.ca>
Subject: ??? set a local env var in perl script
Message-Id: <01bdb716$f0ae4c00$5c0beb2f@colon>
Hi all,
I would like to set a temporary environment variable in my perl script. Is
there a way to to this ? My platform: WinNT
By temporary environment variable, I mean this env variable's life cycle
is limited within the life span of the execution of the script.
You suggestions, comments, hints are greatly appreciated. TIA.
Liming Wang
------------------------------
Date: Fri, 24 Jul 1998 09:17:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: ??? set a local env var in perl script
Message-Id: <MPG.1022537931addf2d989745@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <01bdb716$f0ae4c00$5c0beb2f@colon> on 24 Jul 1998 15:26:50
GMT, Liming Wang <wangli@nortel.ca> says...
> Hi all,
>
> I would like to set a temporary environment variable in my perl script. Is
> there a way to to this ? My platform: WinNT
>
> By temporary environment variable, I mean this env variable's life cycle
> is limited within the life span of the execution of the script.
$ENV{whatever} = 'you wish';
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 24 Jul 1998 16:56:39 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: A question about taint
Message-Id: <6paedl$qfb$3@nz12.rz.uni-karlsruhe.de>
Hi!
|system("ls -al /some/dir") if $verbose&$some_mask
fails if $verbose is tainted. Can anybody explain why?
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: 24 Jul 1998 10:15:30 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Code showing apparent "Perl While Bug"
Message-Id: <obg1fr1drh.fsf@alder.dev.tivoli.com>
Here's a snipit of perlfaq4:
" How do I reset an each() operation part-way through?
Using keys %hash in a scalar context returns the number of
keys in the hash and resets the iterator associated with
the hash. You may need to do this if you use last to exit
a loop early so that when you re-enter it, the hash
iterator has been reset."
I'm guessing that you must also do this if you return early... :)
Mark Simonetti <marks@webleicester.co.uk> writes:
>
> while(($prm1, $prm2) = each(%$donkey)) {
> if($prm2 eq $srch) {
> print "Woohoo !\n";
> return(1);
> }
> }
>
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@tivoli.com
------------------------------
Date: Fri, 24 Jul 1998 16:24:26 GMT
From: John Porter <jdporter@min.net>
Subject: Re: comparing files in perl
Message-Id: <35B8B6C4.15F6@min.net>
Mark-Jason Dominus wrote:
>
> If either of S1 and S2 is empty, the LCS is empty.
>
> If S1 and S2 begin with the same symbol, like (x T1) and (x T2),
> then the longest common subsequence must start with x, and the
> rest of the LCS is the LCS of T1 and T2, which is simpler.
> Similarly if they end with the same symbol.
>
> If S1 and S2 begin with different characters, like (x T1) and
> (y T2), then at least one of x or y will be omitted from the
> LCS. So compute both of LCS(T1, S2) and LCS(S1, T2) and take
> whichever turns out to be longest.
As we can see, this algorithm is highly recursive; it recurses to a
depth
which is equal to the number of elements in the (shorter) array.
Which means we get a discomforting warning from perl for arrays that are
longer than 100. Worse, it means that we get out of memory errors when
comparing arrays that don't seem unreasonably large to us. E.g.,
% wc foo bar
1099 3272 30011 foo
1099 3274 30021 bar
% uname -rs
SunOS 5.4
% dmesg | grep 'mem ='
mem = 32768K (0x2000000)
--
John Porter
------------------------------
Date: Fri, 24 Jul 1998 11:48:18 -0500
From: Alexander Bibighaus <alexb@sig.net>
Subject: confused with list of hashes.
Message-Id: <35B8BAD2.558BD36E@sig.net>
I was reading the more elaborate records cookbook trying to figure out
how to create a list of
records.
for instance, my record fields would be
Port,
SessionID
UserID
Time
Now, I seem to understand that I can create this record by using a hash
such as
(Please correct me if I am wrong)
my(%rec) = (
Port => undef,
SessionId => undef,
UserID => undef,
Time => undef
);
Now, I am confused with the syntax in the example I was reading:
# reading from file
# format: LEAD=fred FRIEND=barney
while ( <> ) {
$rec = {}; # ??
for $field ( split ) {
($key, $value) = split /=/, $field;
$rec->{$key} = $value; # ???
}
push @LoH, $rec; # ??
}
Could someone explain this example for me and maybe how it would relate
to what I am trying to do.
thanks,
alexander
------------------------------
Date: Fri, 24 Jul 1998 17:35:23 GMT
From: John Porter <jdporter@min.net>
Subject: Re: confused with list of hashes.
Message-Id: <35B8C765.7054@min.net>
Alexander Bibighaus wrote:
>
> while ( <> ) {
> $rec = {}; # ??
> for $field ( split ) {
> ($key, $value) = split /=/, $field;
> $rec->{$key} = $value; # ???
> }
> push @LoH, $rec; # ??
> }
This is essentially the same as this:
while (<>) {
my %rec = (); # initialize a new empty hash
for my $field ( split ) {
my( $key, $value ) = split /=/, $field;
$rec{ $key } = $value; # add to hash
}
push @LoH, \%rec; # add hash to array, by ref
}
The point is that arrays can only contain scalars;
so we add references-to-hash, since references are
scalars.
Please note, all those variables really ought to be
lexical, that is, declared with 'my'.
--
John Porter
------------------------------
Date: Fri, 24 Jul 1998 15:43:32 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: Date Question...
Message-Id: <35B8ABA4.258F8AE@inlink.com>
Try this:
$yesterday = localtime((time-86400));
print $yesterday;
HTH,
Brent
------------------------------
Date: Fri, 24 Jul 1998 09:16:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Date Question...
Message-Id: <MPG.10225324eabbc4c989744@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <6paa22$ffb$2@news.iastate.edu> on 24 Jul 1998 15:42:58 GMT,
Josh Kortbein <kortbein@iastate.edu> says...
...
> =item localtime EXPR
>
> Converts a time as returned by the time function to a 9-element array
> with the time analyzed for the local time zone. Typically used as
> follows:
>
> # 0 1 2 3 4 5 6 7 8
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(time);
...
> ... so the idea is to grab the array and then subtract one from the day.
And if that yields 0, subtract 1 from the month and set the day to
something appropriate. And if the month is now -1, subtract 1 from the
year and set the month to 0. And then sprintf the whole thing the way
'scalar localtime' does. Sheesh!!!
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 24 Jul 1998 17:46:58 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: extracting price from string
Message-Id: <6pahai$qds$1@pegasus.csx.cam.ac.uk>
[ Please ignore previous attempt at this, which had erroneous * instead of + ]
F.Quednau <quednauf@nortel.co.uk> wrote:
>$_ = 'product|||500.00||';
>
>/\|{2,3}(.*)\|{2}/;
>
>print $1;
Not a terribly good suggestion. It'll deal with the immediate example,
but'll fail if there are more |s. Better to explicitly reject them:
/\|\|([^|]+)/
But I suspect the original poster should be using split(/\|/, ... )
anyway.
Mike Guy
------------------------------
Date: 24 Jul 1998 17:13:16 GMT
From: "Milan Spingl" <mspring@nortel.com>
Subject: Fetch problem with Oraperl
Message-Id: <01bdb726$a4bf90a0$6486bc2f@PBPDB857.ca.nortel.com>
Hi,
I'm using Perl 5.002 with Oraperl (v. 1.26) and DBI (v. 1.54) extensions
running under HP-UX 9.05 on a 9000/735 box. I have a SQL select statement
that takes about 8 mins to process when run in a SQL script and 4 hrs (!!)
when run in my Perl program. The kicker is, I have another almost an
identical statement that behaves no differently in a SQL script than it
does in the Perl program.
The syntax is as follows:
my $lda = &ora_login ($sid, $user, $pass) || die $ora_errstr;
my $contract_id = "X";
my $sql = <<SQL;
select contract
,product
where contract = '$contract_id'
SQL
my ($cont,$prod);
my $csr = &ora_open ($lda, $sql) || die $ora_errstr;
while (($cont,$prod)
= &ora_fetch($csr)) {
print join(';',$cont,$prod,"\n");
}
&ora_close ($csr);
&ora_logoff ($lda) || die $ora_errstr;
The above select is simplified. In reality it selects 9 fields from a
multiple join with an order by clause. It returns no data (which is
correct for the parameters I'm testing with). The $ora_errno after the
fetch is 0 (zero). Am I doing anything obviously stupid?
Thanks for your timeMilan mspring@nortel.com
------------------------------
Date: Fri, 24 Jul 1998 16:56:40 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: File::Path::rmtree and Taint
Message-Id: <6paedm$qfb$4@nz12.rz.uni-karlsruhe.de>
Hi!
|mh@palandt:/home/mh/rmtreetest > rmtest.pl
|Insecure dependency in unlink while running with -T switch at
|/usr/lib/perl5/File/Path.pm line 206.
|mh@palandt:/home/mh/rmtreetest > less rmtest.pl
|#!/usr/bin/perl -wT
|
|use File::Path;
|
|rmtree("etc");
|mh@palandt:/home/mh/rmtreetest > ls -al
|total 7
|drwxr-xr-x 3 mh users 1024 Jul 24 17:42 .
|drwxr-xr-x 23 mh users 2048 Jul 24 17:41 ..
|drwxrwxrwx 20 mh users 3072 Jul 24 17:42 etc
|-rwxr-xr-x 1 mh users 53 Jul 24 17:42 rmtest.pl
|mh@palandt:/home/mh/rmtreetest >
It looks like rmtree reads in the directory and happily proceeds to rm
the directrory contents which fails since everything that is read from
a directory is tainted.
Is this a bug or a feature? How am I suppose to delete entire subtrees
in a secure environment?
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: 24 Jul 1998 16:54:34 GMT
From: "Sabre Taylor" <nonspammers.cut.after.the.period.hot_redox@hotmail.com>
Subject: free Perl books online
Message-Id: <01bdb723$b129ffe0$c1620c8a@lnxcompaq.lexis-nexis.com>
hi all,
i'm not associated with the following company,
but found their books to be of help.
at http://www.mcp.com/personal/ they have some free
online Perl books.
Sabre Taylor
------------------------------
Date: Fri, 24 Jul 1998 16:12:33 GMT
From: rsnell@my-dejanews.com
Subject: Re: future date in epoch time
Message-Id: <6pabph$2c7$1@nnrp1.dejanews.com>
In article <6p9r9g$oqn$1@nnrp1.dejanews.com>,
sjborden@my-dejanews.com wrote:
> Does anyone have any ideas how to take a future date (i.e. 12/31/98) and
> convert it to epoch time?
>
> Thank you.
> Sue
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
Did you ever hear from anyone? I am have the same question.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 24 Jul 1998 12:52:57 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: richard.hakim@entrust.com
Subject: Re: HELP! Hash of refs to objects
Message-Id: <pvev87ba.fsf@mailhost.panix.com>
Richard Hakim <rhakim@cyberus.ca> writes:
> %hash = (
> 'GLOBAL' => new Global,
> );
>
> But when I try to do $hash{GLOBAL}->process(), of course, it bails.
What do you mean by "it bails"? Without knowing what error actually
occurs, it's impossible to guess what might be the problem. Does the
following not work for you?
#!/usr/local/bin/perl -w
use strict;
package Foo;
sub new {
my $class = shift;
return bless { MEMBER => 'fjord' }, $class;
}
sub get_member { return $_[0]->{MEMBER} }
package main;
my %h = ( THING => new Foo, );
print $h{THING}->get_member();
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 24 Jul 1998 13:18:52 -0400
From: Dean Pentcheff <dean@mail.biol.sc.edu>
Subject: Re: how do you extract information from a cgi page?
Message-Id: <m3n29zw4jn.fsf@mail.biol.sc.edu>
"Dom" <domv@addme.com> writes:
> This is a multi-part message in MIME format.
Why? This is Usenet, not a proprietary email system.
> [MIME junk elided]
>
> How do you extract information from a cgi page? I want to search for words
> (like a search engine) but not on an HTML page but from a page generated by
> a cgi script. How do you do that with perl?
>
> Thanks in advance!
The same way you'd deal with information from an HTML page. By the
time the server has spewed it back to the client, there's really no
difference whether the text came from a static HTML page or was
dymagically created by a CGI program.
You'll want to check into the CPAN of useful Perl modules (start at
http://www.perl.com and hunt for CPAN). Once there, you'll want to
fetch and install the LWP module(s).
Good luck!
-Dean
--
N. Dean Pentcheff <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)
------------------------------
Date: Fri, 24 Jul 1998 16:50:18 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: How to know the number of hash items without running loop.
Message-Id: <6pad8t$hl$1@rand.dimensional.com>
[posted to comp.lang.perl.misc and mailed to the cited author]
In article <6p9ts3$s6f@news-central.tiac.net>
mike@stok.co.uk (Mike Stok) wrote:
>In article <6p8an0$76d$1@rand.dimensional.com>,
>Daniel Grisinger <dgris@rand.dimensional.com> wrote:
>
>>More correctly, the above approach should be-
>> $numitems = $#hkeys + 1 - $[;
>
>Why not just
>
> $numitems = @hkeys;
I just wanted to show that using
$numitems = $#hkeys + 1;
to count the elements won't always work the
way poster apparently expects :-).
Regards,
Daniel
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: Fri, 24 Jul 1998 16:34:33 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35B8B926.42E5@min.net>
Zenin wrote:
>
> True, fonts are in the system. However, applications are free
> to add fonts to the system.
> Even under X, if the application is installed under a user's
> directory it can still have its own font and just include
> it in the search path.
O.k., but that's a strange meaning of "in the editor".
--
John Porter
------------------------------
Date: Fri, 24 Jul 1998 16:42:44 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35B8BB10.57D5@min.net>
Kai Henningsen wrote:
>
> If that were true, there could be no bugs in the perl implementation.
> After all, whatever the consequences of the bug, it would define the
> language, and thus be ok.
Not so. "bugs" are things which are not o.k.
The implementation has them, and therefore the definition has them
(according to my semantics); but that doesn't make them o.k.
--
John Porter
------------------------------
Date: Fri, 24 Jul 1998 16:43:51 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35B8BB54.30BC@min.net>
Georg Bauer wrote:
>
> Perl is defined by more than just the single
> implementation that's around.
Of course; it's defined by the many implementations
that are around
--
John Porter
------------------------------
Date: 24 Jul 1998 16:50:44 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl Beautifier Home Page
Message-Id: <901299639.95686@thrush.omix.com>
John Porter <jdporter@min.net> wrote:
: O.k., but that's a strange meaning of "in the editor".
s/in/with/; You're right, it would have sounded better. :-)
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Fri, 24 Jul 1998 15:45:38 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: perlfaq
Message-Id: <35B8AC22.A8AA5551@inlink.com>
gpsingh@mailcity.com wrote:
>
> Hey,
> Where can i get perlfaq4/5 , perldoc information.
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq.html
> Thanks
No problem
> GP
> PS: Please respond at gsingh@exodus.net
No.
------------------------------
Date: Fri, 24 Jul 1998 09:10:02 -0600
From: Jeff Stampes <jeff.stampes@xilinx.com>
To: "gpsingh@mailcity.com" <gpsingh@mailcity.com>
Subject: Re: perlfaq
Message-Id: <35B8A3CA.B510A152@xilinx.com>
[CC Sent to requestor, since he didn't munge his address]
gpsingh@mailcity.com wrote:
>
> Hey,
> Where can i get perlfaq4/5 , perldoc information.
> Thanks
> GP
> PS: Please respond at gsingh@exodus.net
the documentation and FAQ come with the standard distribution
of perl. The perldoc executable should be in the same place
as your perl binary, and doing a 'perldoc perldoc' will teach
you to use it.
If your installation is incpmplete, go to www.perl.com
-Jeff
------------------------------
Date: Fri, 24 Jul 1998 16:27:36 +0000
From: Chris Bero <cbero@uwyo.edu>
Subject: Re: Returning values from a child process
Message-Id: <35B8B5F8.231FF84@uwyo.edu>
Thanks Andrew!
I'm getting some progress with simple pipes. Still, if you know of a good
module repository, I'm running Red Hat Linux 5.0 with an unmodified linux
kernel.
Cheers, and thanks again,
Chris
Andrew M. Langmead wrote:
>
> Chris Bero <cbero@uwyo.edu> writes:
>
> >If I have a parent process which forks to a child process and that child does
> >some kind of processing of a variable, is there a way to return the new value of
> >that variable to the parent process? (my god, that was one sentence!)
>
> Open a pipe before you fork, have the child write the variable to the
> pipe, and have the parent read the pipe and store the result in the
> variable. Or use a piped open and have the child write it to STDOUT.
>
> Or take a look and see if someone wrote a "shared memory" module for
> your operating system variant. (If you told us what kind of Unix box
> you were working with, I might just be able to point you to the right
> one.)
>
> --
> Andrew Langmead
--
___________________________________________________________.
Christopher R. Bero Phone: (307)766-6195 |
Head Geek, FAX: (307)766-2652 |
Wyoming InfraRed Observatory mailto:cbero@uwyo.edu |
University Wyoming Resume: |
P.O. Box 3905 http://kafka.uwyo.edu/resume |
Laramie, WY 82071-3905 |
-----------------------------------------------------------+
------------------------------
Date: Fri, 24 Jul 1998 12:35:00 -0400
From: Earl Westerlund <earlw@kodak.com>
Subject: Re: spss file format
Message-Id: <35B8B7B4.7BF0@kodak.com>
Apologies. The active newsgroup is news:comp.soft-sys.stat.spss.
Earl Westerlund wrote:
>
> S.R.M. Walsh wrote:
> >
> > I am a computer science student at the University of Liverpool (U.K)
> > and I am currently engaged in a project involving spss.
> > I have created web pages that include an online form which is then
> > processed by a cgi program (written in Perl5). The data is saved in
> > files using name=value,(value),etc.. pairs. I now wish to write another
> > perl program that will read in each of these files and convert them into
> > spss files. However I do not know what has to be included in these
> > files and the exact syntax of the contents. I would be very grateful if
> > anyone can point me to relevant sources of information.
>
> Have you tried news:comp.soft-sys.spss?
--
+-----------------+----------------------------------------+
| Earl Westerlund | Kodak's Homepage: http://www.kodak.com |
+-----------------+----------------------------------------+
| The opinions expressed herein are mine and mine alone |
| (most people don't seem to want them anyway) |
+----------------------------------------------------------+
------------------------------
Date: Fri, 24 Jul 1998 16:56:19 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Text processing question
Message-Id: <35B8BE3F.5E13@min.net>
F.Quednau wrote:
>
> @to_use = qw / 0.045 0.037 0.023 /;
>
> while (<DATA>) {
> chomp;
> push @file, line($_);
> }
>
> sub line {
> my @line = split /\t/, +shift;
> @line = map { length $_ ? $_ : shift @to_use } @line;
Way bogus bug there, Frank.
This is destructive to @to_use.
You get three chances; then @to_use is empty.
> return \@line;
> }
>
> for (@file) {
> print join("\t", @$_),"\n";
> }
Maybe this is neater:
print
sort { $a <=> $b }
map {
my @line = split /\t/;
for my $i ( 1..3 ) {
$line[$i] =~ /\S/ or $line[$i] = $to_use[$i-1];
}
join "\t", @line;
}
<DATA>;
--
John Porter
------------------------------
Date: Fri, 24 Jul 1998 13:21:50 -0400
From: "Chuanlarp Satchavarodom" <josephs@fenix2.dol-esa.gov>
Subject: Unable to make Perl?
Message-Id: <6paftu$nta$1@supernews.com>
Dear All,
I downloaded perl recently tried to compile it. The configuration
went okay, but I when I tried to make it. The making process stopped almost
immediately saying that it does not know how to make perl README file.
How do I resolve this?
Thank you
Joseph
------------------------------
Date: 24 Jul 1998 13:31:21 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "David Travis" <david@system-concepts.com>
Subject: Re: Why can't I "require" a file?
Message-Id: <n29z85ja.fsf@mailhost.panix.com>
"David Travis" <david@system-concepts.com> writes:
> The compiler fails at the require line and complains that $file
> "did not return a true value".
Whenever you get a message that you don't understand, you may look it
up in the "perldiag" manual that comes with perl. You may also add
the "use diagnostics;" pragma to your script, and it will do the
lookup for you. Highly recommended.
%s did not return a true value
(F) A required (or used) file must return a true value to
indicate that it compiled correctly and ran its
initialization code correctly. It's traditional to end such
a file with a "1;", though any true value would do. See the
"require" entry in the perlfunc manpage.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3246
**************************************