[11280] in Perl-Users-Digest
Perl-Users Digest, Issue: 4880 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 12 13:07:24 1999
Date: Fri, 12 Feb 99 10:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 12 Feb 1999 Volume: 8 Number: 4880
Today's topics:
Re: "cloning" tied hashes <bmb@ginger.libs.uga.edu>
Re: "cloning" tied hashes (Ilya Zakharevich)
"Learning Perl" <bgarrett@hamilton.net>
Re: \n won't work <bgarrett@hamilton.net>
can't locate loadable object for module? dubing@lisco.com
Re: change column of nmbers to 2 dim array (Abigail)
Re: change column of nmbers to 2 dim array (Abigail)
Re: Comments in Perl code <aqumsieh@matrox.com>
Re: Comments in Perl code (Abigail)
DESPERATE Help required PLEASE! <bgibby@iinet.net.au>
Re: Direcory listing, another way. <chad@vcn.net>
Re: Does Perl restrict regular expressions? <jdf@pobox.com>
Re: Easy Q for a Perl Pro (Tad McClellan)
Re: Easy Q for a Perl Pro <aqumsieh@matrox.com>
Re: Fast Text Search <chad@vcn.net>
How2 convt from %hash to URL keys=vals johnvv@my-dejanews.com
Insecure $ENV{ENV} complaint from -T <jbossert@dazel.com>
Re: newbie: hitcounter <jonz@rmi.nospam.net>
Re: No. of lines in a file (Greg Ward)
Perl and Visual Studio <gyows@globeset.com>
Re: Perl4 binaries for Aix4.1/RS600 ? <jglascoe@giss.nasa.gov>
Re: silly simple query <aqumsieh@matrox.com>
Re: syntax error I can't find? (John G)
Trouble 'make'ing CPAN Modules! <david@inxpress.net>
Unable to output after system call and opening another (Kathy Lessa)
Re: Unable to output after system call and opening anot <david@inxpress.net>
Re: unique hashnames <mgcook@ic.delcoelect.com>
Re: using perl to talk to oracle database (Peter Scott)
x-perl what's that? (Steve .)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 12 Feb 1999 10:41:35 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: "cloning" tied hashes
Message-Id: <Pine.A41.4.02.9902121018450.35848-100000@ginger.libs.uga.edu>
On Fri, 12 Feb 1999, Eric Bohlman wrote:
> Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
> : 1) %sgmlrecs2 = %sgmlrecs1;
> : 2) while( my( $key, $val ) = each %sgmlrecs1 ) {
> : $sgmlrecs2{ $key } = $val;
> : }
> Not that I know of, if your class is implemented correctly. Without
> looking at the code, I can't tell, but make sure that you aren't using
> package globals where you should be using instance variables.
Very interesting. I was indeed using a package global that I see now
should have been in the object instead. I have made that change, and am
still seeing the undefined values (2 consistently out of the 8125
records). I may or may not take the time to investigate further. It
occurred to me that I *really* don't want to do
'%sgmlrecs2 = %sgmlrecs1;', because unless I'm mistaken, perl flattens
those 8125 records into a list first. Right?
Thanks for the reply--I'm glad I asked,
-Brad
------------------------------
Date: 12 Feb 1999 17:27:19 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: "cloning" tied hashes
Message-Id: <7a1o9n$mmn$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Brad Baxter
<bmb@ginger.libs.uga.edu>],
who wrote in article <Pine.A41.4.02.9902121018450.35848-100000@ginger.libs.uga.edu>:
> > : 1) %sgmlrecs2 = %sgmlrecs1;
> Very interesting. I was indeed using a package global that I see now
> should have been in the object instead. I have made that change, and am
> still seeing the undefined values (2 consistently out of the 8125
> records). I may or may not take the time to investigate further.
Looks like 5.004. Right? A lot of things were fixed since then.
Ilya
------------------------------
Date: Fri, 12 Feb 1999 11:45:15 -0800
From: Bill Garrett <bgarrett@hamilton.net>
Subject: "Learning Perl"
Message-Id: <36C484C9.11DFA57E@hamilton.net>
I got the book "Learning Perl" and for some reason some of the
source code doesn't work.
I took this code exactly from the book and it doesn't work:
#!/usr/local/bin/perl -w
print "What is your name?";
$name = <STDIN>;
chomp ($name);
print "Hello, $name!\n";
What could be the problem?
Does it only run from the shell?
------------------------------
Date: Fri, 12 Feb 1999 11:42:32 -0800
From: Bill Garrett <bgarrett@hamilton.net>
Subject: Re: \n won't work
Message-Id: <36C48426.1F49BDA9@hamilton.net>
So how would i do it if I took out the print "Content-type: text/html\n\n";
?
CybnR wrote:
> If you are trying to print this to an html document you need a <br> tag
> inbetween the lines, \n just makes a new line in the html source.
> Ex.
>
> #!/usr/local/bin/perl
> print "Content-type: text/html\n\n";
> print "hello world<br>\n";
> print "Oh look it makes new lines<br>\n";
> print "I'm so glad!<br>\n";
>
> Bill Garrett wrote:
>
> > #!/usr/local/bin/perl
> > print "Content-type: text/html\n\n";
> > print "hello world\n";
> > print "how come the new line character won't work?\n";
> > print "I sure wish it would!\n";
> >
> > Could someone please tell me why \n doesn't cause this to go onto a new
> > line. I created this script and \n doesn't work but on some other
> > scripts I have installed it worked. hwat is wrong with this one??
> > thanks,
> > jason@wbdet.com
------------------------------
Date: Fri, 12 Feb 1999 17:21:27 GMT
From: dubing@lisco.com
Subject: can't locate loadable object for module?
Message-Id: <7a1nua$fmi$1@nnrp1.dejanews.com>
Hello there,
My perl script need to:
use Net::LDAPapi;
So I added:
BEGIN {
push(@INC, '/net/info/pub/sun4/lib/perl5-/site_perl');
}
at the beginning of the script. LDAPapi.pm is located in the subdir of the
above dir.
However when I run this script, I still got the following error:
Can't locate loadable object for module Net::LDAPapi in @INC (@INC
contains: /public/lib/perl5/5.00501/sun4-solaris /public/lib/perl5/5.00501
/public/lib/perl5/site_perl/5.005/sun4-solaris
/public/lib/perl5/site_perl/5.005 . /net/info/pub/sun4/lib/perl5-/site_perl)
at ./sample.pl line 8 BEGIN failed--compilation aborted at ./sample.pl line
8.
Note: line 8 is "use Net::LDAPapi"
What's wrong? Can anybody help me out of this problem? Because I do not
come to this group quite often, please send me your help at
bing-du@cis-gw.tamu.edu.
Thanks in advance for your help.
Bing
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 12 Feb 1999 16:19:08 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: change column of nmbers to 2 dim array
Message-Id: <0wYw2.2744$rs2.2561078@client.news.psi.net>
Bart Lateur (bart.lateur@skynet.be) wrote on MCMXCI September MCMXCIII in
<URL:news:36c6e29a.2496890@news.skynet.be>:
,, Abigail wrote:
,,
,, >Who says map changing the elements of the list it iterates over has
,, >something to do with using it in void context?
,, >
,, >In fact, map is an operation heavily used in functional languages.
,, >Functional languages have a tendency to be side effect free as well.
,,
,, So using map in order to have side effects is bad form?
*I* am not the person claiming things are bad form. Ask Randal.
,, Changing the
,, elements of a list is a side effect too.
,,
,, "map in a void context" is virtually synonymous to map with side
,, effects. Tell me, what use would the next code be, except to waste
,, cycles?
,,
,, map { $_.$_ } LIST;
Just as useful as
foreach (LIST) {$_ . $_}
What's your point?
,, "map" is a looping construct. But to stay absolutely clean, you may not
,, depend on it being executed in sequence. So the next is bad form too:
,,
,, my $i = 0;
,, %map = map { $_ => $i++ } @ary;
So, you are claiming that
@squares = map {$i * $i} 1 .. 10;
isn't garanteed to produce the first 10 squares in order? Are you sure?
Can you give me any references that this isn't garanteen?
,, because the phrase "$i++" has a side effect, and you may not depend on
,, map applying the block to each array element *in turn*. That may always
,, be the case now, but it's not part of the function specification. A
,, highly parallel machine might give a few array elements to several
,, processors to apply the BLOCK to, (in principle, map allows that), in
,, which case the previous code will break.
Oh, really? Then tell, what can we use map {} for?
,, It is bad form to depend on unspecified implementation details.
,,
,, >!! Besides, what do you find so attractive in:
,, >!!
,, >!! map BLOCK LIST;
,, >!!
,, >!! over:
,, >!!
,, >!! foreach (LIST) BLOCK
,, >
,,
,, >Order in which things appear. What I do is often more important then
,, >on what I perform things.
,,
,, How about:
,,
,, do { BLOCK } foreach (LIST);
That's new syntax, more typing, ugly, and doesn't use a convential name
like map.
,,
,, >What's so attractive about foreach (LIST) {BLOCK} ?
,,
,, Because that's an explicit loop. You *may* depend both on execution
,, sequence and side effects, including changing the original items.
But changing the original items using map is clearly documented in perlfunc!
Abigail
--
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
${qq$\x5F$} = q 97265646f9 and s g..g;
qq e\x63\x68\x72\x20\x30\x78$&eggee;
{eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
------------------------------
Date: Fri, 12 Feb 1999 16:20:34 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: change column of nmbers to 2 dim array
Message-Id: <mxYw2.2745$rs2.2561078@client.news.psi.net>
Bart Lateur (bart.lateur@skynet.be) wrote on MCMXCI September MCMXCIII in
<URL:news:36c6e29a.2496890@news.skynet.be>:
\\
\\ "map" is a looping construct. But to stay absolutely clean, you may not
\\ depend on it being executed in sequence.
So, the Schwartzian Transform is wrong?
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Fri, 12 Feb 1999 11:34:51 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Comments in Perl code
Message-Id: <x3ysocb4m38.fsf@tigre.matrox.com>
tadmc@metronet.com (Tad McClellan) writes:
> Ala Qumsieh (aqumsieh@matrox.com) wrote:
> : % perl -pi.bak -e 's/\#.*$//' file.pl
>
> You forgot a smiley there, I think.
:-)
------------------------------
Date: Fri, 12 Feb 1999 17:27:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Comments in Perl code
Message-Id: <fwZw2.2747$rs2.2589589@client.news.psi.net>
Ronald J Kimball (rjk@linguist.dartmouth.edu) wrote on MCMXCI September
MCMXCIII in <URL:news:1dn36fs.noo1jqtj9jygN@bay1-307.quincy.ziplink.net>:
'' Abigail <abigail@fnx.com> wrote:
''
'' [wrapped due to line length limits]
''
'' > perl -wle\$_=\<\<EOT\;y/\\\\n/\ /\;print\;
'' > -eJust -eanother -ePerl -eHacker -eEOT
''
'' What shell should this one be run under?
You're right. The extra \'s shouldn't have been there. I switched from
print '...' to print <<'EOT', and forgot to remove some \'s.
Abigail
--
perl -wlpe '}{$_=$.' file # Count the number of lines.
------------------------------
Date: Sat, 13 Feb 1999 00:50:29 +0800
From: "Bradley J. Gibby" <bgibby@iinet.net.au>
Subject: DESPERATE Help required PLEASE!
Message-Id: <7a1m3v$p9r$1@news.iinet.net.au>
Hi all...
I'm trying to write a search feature for a small text database.
Here's bit of the total code:
open (DB, "database.txt");
print "Content-type: text/html\n\n";
while(<DB>) {
foreach $key (@keywords) {
if ($_ =~ /$key/) {
($url, $comp, $desc) = split(/::/);
print $url . "/" . $comp . "/" . $desc . "<br>\n";
}
}
close (DB);
What I need it to do is for every keyword the user enters, loop thru each
line in the database and using regular expressions, find if the keyword
occurs at any time ( case sensitive ) within any line.
Once it's found a match, the line is then broken up into it's components.
A sample line from the database is:
http://www.iinet.net.au/~bgibby/index.html::Gibby Enterprises::- This is the
Gibby Enterprises Web Site
If ANYONE can give me ideas and/or suggestions as to what I'm doing wrong,
or how to fix it I BEG that you reply to me via email
( bgibby@iinet.net.au ). THANK YOU SO VERY MUCH!
--
Bradley J. Gibby
http://www.iinet.net.au/~bgibby/index.html
------------------------------
Date: Fri, 12 Feb 1999 17:02:47 GMT
From: Chad M. Townsend <chad@vcn.net>
Subject: Re: Direcory listing, another way.
Message-Id: <7a1mrf$ejt$1@nnrp1.dejanews.com>
You can use 'glob' and you get a filter! Oh joy.
--snip
foreach (glob '/path/to/dir/*.html') {
print "$_\n";
}
--snip
-chad
In article <36c222cb.95535104@news.webhart.net>,
cybear_x[nospam]@geocities.com (Cybernetic Bear) wrote:
> I need to know how to read in a list of the files in a directory. I
> just need the file names for now.
>
> Thanks
> Dave
>
--------------------------------------------------------
Chad M. Townsend Virtual Community Network, Inc.
Chief Technical Officer Your Local Community Online!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Feb 1999 11:48:38 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: Does Perl restrict regular expressions?
Message-Id: <m31zjvy3dl.fsf@joshua.panix.com>
Piers Cawley <pdcawley@bofh.org.uk> writes:
> Jonathan Feinberg <jdf@pobox.com> writes:
> > perl -lne '$c++ if /somepattern/;END{print "$c\n"}' file
> I was under the impression that he wanted something that could be
> dropped into production code. I may be sticking my neck out here,
> but some of the more outlandish one- liners which have cropped up in
> this thread aren't much use in the 'production' context.
"Outlandish"? Hardly! Such a program is very much in the spirit of
the language. If you want it to look like a script...
#!/usr/bin/perl -wln
$line_count++ if /pattern/;
END { print $line_count || 0 }
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Fri, 12 Feb 1999 08:55:15 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Easy Q for a Perl Pro
Message-Id: <jcf1a7.5nt.ln@magna.metronet.com>
Dustin Christopher Preuitt (preuitt@ix.cs.uoregon.edu) wrote:
: I need to help in doing the following:
: I want to take a line of text and translate everything in parenthesis to uppercase and everything else to lower case.
: Example:
: My keys are in the (upper left) drawer.
: would become
:
: my keys are in the (UPPER LEFT) drawer.
-----------------
#!/usr/bin/perl -w
use strict;
$_ = 'My keys are in the (upper left) drawer.';
$_ = lc($_); # force everything to lower case
s/(\([^)]+\))/\U$1/; # if in non-nested and balanced parens
# upper case it correctly
# else
# do something broken or do nothing!
print "$_\n";
-----------------
See also the Perl FAQ, part 6:
"Can I use Perl regular expressions to match balanced text?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 12 Feb 1999 11:32:25 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Easy Q for a Perl Pro
Message-Id: <x3yu2wr4m7a.fsf@tigre.matrox.com>
lr@hpl.hp.com (Larry Rosler) writes:
> > $line = lc $line;
> > $line =~ s/(\([^\)]*\))/\U$1/g;
> ^
> Just to avoid misleading anyone, that backslash is superfluous.
> Parentheses are not special inside character classes.
True .. but I personally usually stick it in there or else it screws
up my syntax highlighting.
------------------------------
Date: Fri, 12 Feb 1999 17:09:35 GMT
From: Chad M. Townsend <chad@vcn.net>
Subject: Re: Fast Text Search
Message-Id: <7a1n85$eq7$1@nnrp1.dejanews.com>
Look into 'DB_File'.
-chad
Einar Gudmundsson <einar.gudmundsson@realtime.co.uk> wrote:
> Zack wrote:
> >
> > What's the fastest way to search through a delimited text database. Line by
line and checking the individual fields after a split is fine up to about
5,000 records or so, but I really need to use bigger databases (up to
50-100,000 records) and a DBI database is not an option.
>
> Why isn't a RDBMS an option. MySQL is a free product supporting most
> platforms, and
> supports almost all the features of a professional RDBMS suite like
> Oracle or Sybase,
> but usually works faster - up till 2-3 times.
>
> Regrads
> Einar Gudmundsson
>
--------------------------------------------------------
Chad M. Townsend Virtual Community Network, Inc.
Chief Technical Officer Your Local Community Online!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 12 Feb 1999 15:56:19 GMT
From: johnvv@my-dejanews.com
Subject: How2 convt from %hash to URL keys=vals
Message-Id: <7a1iut$ao7$1@nnrp1.dejanews.com>
Hello all,
I have been using buttons to send info back to the server but since my data
is i n tables I thought a button would look rather awkward, so I want to use
a hypert ext link with the values at the end of the url.
I'm looking for a source to translate between perl and the URL type of
"values c ode" so I can put it in the table cell as a link.
The code would go like this:
%$myhash = ( nam1, val1, nam2, val2,....)
$str = $ob -> dump($my_hash) ; # my version of Dumper::dump
$hyp_str = dosomething($str) ;
print "/cgi-bin/cgi.cgi/sub-name/$hyp_str" ;
My question is how do I create (or get) "dosomething()"
Thanks in advance, John van V.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 12 Feb 1999 23:27:12 +0800
From: John Bossert <jbossert@dazel.com>
Subject: Insecure $ENV{ENV} complaint from -T
Message-Id: <36C44850.74B601CB@dazel.com>
I developed a fairly simple script on NT. While deploying it on an
HP/UX 10.20 system, I discovered that my script is being called by a
setuid script. As such, I'm welcomed to the world of tainting... I've
read the perlsec pages and have slogged through $PATH complaints, etc.
but now find _certain_ users (but not others!) receiving the following
error message:
"Insecure $ENV{ENV} while running with -T switch at
/opt/sw/mol_test/bin/np.pl line 130, <STDIN> chunk 1." My script is
invoked with "perl -wT"
Again, some (most) users have no problem. Everyone is running ksh,
sourcing a common .profile. I explicitly set the $PATH within the
script.
Any idea as to what I should be looking at?
--
====================================================================
John Bossert email: jbossert@dazel.com
Systems Engineer voice: 425.462.2060
Dazel Corporation fax: 425.462.2064
800 Bellevue Way NE, Suite 400 pager: 800.SKY.PAGE pin 1454252
Bellevue, WA 98004 URL: http://www.dazel.com
------------------------------
Date: 12 Feb 1999 16:46:02 GMT
From: Jonesy <jonz@rmi.nospam.net>
Subject: Re: newbie: hitcounter
Message-Id: <7a1lsa$evt$1@news1.rmi.net>
I R A Aggie <fl_aggie@thepentagon.com> wrote:
: On Thu, 11 Feb 1999 23:17:58 +0100, Alan J. Flavell
: <flavell@mail.cern.ch> wrote:
: + On 11 Feb 1999, I R A Aggie wrote:
: + > Hitcounters lie.
: + Nope, they count exactly what they count.
: You're right. They're mis-named. "Number of requests for this page to this
: web server" may be more descriptive?
Even _that_ is inaccurate. If you are using the 'graphical' hit
counter used by many ISPs for their customers' /~accounts, you'll
count no hits with lynx and/or with the cartoon browsers that have
cartoons turned off.
Jonesy
--
Marvin L. Jones jonz<AT>rmi.net
Gunnison, Colorado
322 days to go until the Year 2000
687 days to go until the 3rd Millennium of the C.E.
------------------------------
Date: 12 Feb 1999 17:56:33 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: No. of lines in a file
Message-Id: <7a1q0h$4t2$1@news0-alterdial.uu.net>
krish_v@my-dejanews.com <krish_v@my-dejanews.com> wrote:
> I've seen Abigail use
> perl -wlpe '}$_=$.;{' filename
> to find the number of lines in a file.
> What is the role of the following?
> l, } and {
I just saw that nasty (nifty?) trick in a post yesterday, and was
scratching my head as to how it worked until I actually tried it.
Here's a hint: run it through the debugger, ie.
perl -dwlpe '}$_=$.;{' filename
and you'll see the code that's actually run. The key, apparently, is
that Perl just constructs the program to run by gluing text fragments
together. (Disclaimer: I've not looked at the source, I'm just
inferring from observed behaviour. So I could be wrong.)
That is, when you say "perl -pe FOO", the program that is run is:
LINE: while (<>) {
FOO
} continue {
print or die "-p destination: $!\n";
}
In fact, this is explained in the "perlrun" man page -- it just doesn't
come right out and tell you that FOO is just pasted into the template
program. So what Abigail's funny little trick -- "perl -pe '}$_=$.;{'
-- does is run this script:
while (<>) {
}$_=$.;{
} continue {
print or die "-p destination: $!\n";
}
which would look a little clearer if reformatted:
while (<>) {}
$_=$.;
{} continue {
print or die "-p destination: $!\n";
}
Remember, any block can have a continue block -- it doesn't have to be a
loop (see perlsyn). Other than that, this is perfectly straightforward
Perl.
Obviously the product of a twisted mind (no offense, I hope!), and not
something you should use in code that anybody else will have to read.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Fri, 12 Feb 1999 11:17:42 -0600
From: "Gregg Yows" <gyows@globeset.com>
Subject: Perl and Visual Studio
Message-Id: <7a1nq3$i1r$1@onion.globeset.com>
So, my company is having a hard time springing for a Codewright license. I
KNOW I should use VI, but I was wondering if anyone knew how to configure
Visual Studio to "chromacode" my .pl files-similar to the way Codewright
does.
Let the flames begin.
G
------------------------------
Date: Fri, 12 Feb 1999 10:55:45 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Keld Wesenberg =?iso-8859-1?Q?Lyngs=F8?= <kwl@pine.dk>
Subject: Re: Perl4 binaries for Aix4.1/RS600 ?
Message-Id: <36C44F01.C713B72E@giss.nasa.gov>
[courtesy cc of this posting sent to cited author: Keld]
Keld Wesenberg Lyngs=F8 wrote:
> =
> Hello All,
> =
> Is there someone who knows a site where I can optain
> Perl4 binaries for Aix4.1/RS6000 ?
no.
however, you can get *Perl5* binaries from =
ftp://aixpdslib.seas.ucla.edu/pub/perl/RISC/4.1/exec/
> Thanks in advance
> Keld
--
"Try not! there is no *try*, only *do*."
[or something to that effect, -ed.]
-- Yoda
------------------------------
Date: Fri, 12 Feb 1999 11:27:42 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: silly simple query
Message-Id: <x3yvhh74mf6.fsf@tigre.matrox.com>
"Gavin Cato" <gavin@optus.net.au.dontspam.myass> writes:
>
> What would be the perl equivalent of
>
> cat $filename | grep $variable | wc -l
No need for cat or wc anyway:
% grep -c variable filename
> i.e. I want to slurp a entire file in, and count the amount of times that a
> certain piece of text is matched in that file.
% perl -ne 'BEGIN { $count = 0} $count++ if /variable/; sub END {print
"Count is $count"}' filename
> Maybe something roughly to do this? (warning perl newbie)
>
> open (FILE, "$file") || die "can't open file";
I would add $! in your die() string to know the exact reason of the
failure (if it happens)
> while (<FILE>) {
> ($string) = (split/"string to match"/) [0];
> $tally = $tally + 1;
That will increase $tally regardless of the value of $string. What you
need is something like:
$tally++ if /string to match/;
> }
>
> print "For $file, the string $string was found $tally times\n";
^^^^^^^
shouldn't that be "string to match"?
HTH,
Ala
------------------------------
Date: Fri, 12 Feb 1999 16:14:06 GMT
From: cybpunk@geocities.com (John G)
Subject: Re: syntax error I can't find?
Message-Id: <36c8534b.8551425@news.ma.ultranet.com>
Yes i realized that to. I've developed bad habits coding in C++ which
is more
lenient with the comparison operators. Sorry about posting in a new
message. I
mean to fix that today. I posted the message before I went to bed,
and didn't want
to wait a hour or so till it got through, so I could post a reply.
Yup, I may have
horrible spelling but I am consistent.
Thanks
-John
On Fri, 12 Feb 1999 01:11:25 -0800, lr@hpl.hp.com (Larry Rosler)
wrote:
>[Posted and a courtesy copy mailed.]
>
>In article <36c346a3.14194921@news.ma.ultranet.com> on Thu, 11 Feb 1999
>21:13:13 GMT, John G <cybpunk@geocities.com> says...
>...>
>> 23:if (($in{a1pattern1} == "splash") && ($in{a1pattern2} == "none")) {
>> 24: ++$total;
>> 25: $anwsers[0] = 0;
>> 26:} else if ((($in{a1pattern1} == "splash") && ($in{a1pattern2} !=
>> "none")) || ($in{a1pattern2} == "splash")) {
>> 27: $total += .5;
>> 28: $anwsers[0] = .5;
>> 29:} else {
>> 30: $anwsers[0] = 1;
>> 31:}
>
>Your retraction (which should have been posted in response to this one,
>so it wouldn't start a new thread) presumably refers to your
>realization that in Perl 'else if' is spelled with a few fewer
>characters. But did you also realize that in Perl, strings are compared
>using 'eq', not '=='? And in English, 'anwsers' is spelled 'answers'
>(but it doesn't matter much in Perl if you're consistent)?
>
>Cheers,
------------------------------
Date: Fri, 12 Feb 1999 09:17:11 -0600
From: "David M. Lloyd" <david@inxpress.net>
Subject: Trouble 'make'ing CPAN Modules!
Message-Id: <36C445F7.C5EE9D40@inxpress.net>
Hello,
I warn you now I am realtively new at Perl, and have learned it more
because I needed to rather than at my liesure.
That said, here's my dilemma:
I am implementing a multi-process system in Perl, and I decided to try
the PlRPC module. I downloaded it and intalled it, at which point it
told me that I was missing Net::Daemon and Storable. No problem; I
then downloaded the two missing modules from the same ftp site. The
problem arose, however, when I tried to run the makefile for either
one. I get this error:
make: don't know how to make /usr/local/perl/config.sh. Stop
Now I don't know much about make, but it seems to me there is some
basic configuration issue. Can anyone point me in the right direction
or is this the wrong group to ask this in? Reply here or email,
I'll check both. Thanks a lot!
===========================================================
David M. Lloyd mailto:david@inxpress.net
Administrator
Internet Express, Inc.
802 W. Broadway, Suite 0101
Madison, WI. 53713-1866
Voice: (608) 663-5555 http://www.inxpress.net
Fax: (608) 663-1818 mailto:admin@inxpress.net
Data: (608) 663-5551 mailto:support@inxpress.net
===========================================================
------------------------------
Date: Fri, 12 Feb 1999 17:14:46 GMT
From: klessa@NOSPAMairmail.net (Kathy Lessa)
Subject: Unable to output after system call and opening another file
Message-Id: <A4B45EF89619B291.B7A180E2CC891848.A985131AA89C41AE@library-proxy.airnews.net>
I am sure I'm missing something quite simple here, but I'm having some
difficulties. I would appreciate any assistance I could get on it.
Thanks!
I have to make a system call to a program which creates a text file.
print "Content-type: text/html\n\n" ;
$ret=system("Code.exe $infile >err.out" ) ;
# this works fine... the err.out (zero length) is created, and the
# text file that is supposed to be created by code.exe is getting
# written just fine.
print "retcode is $retcode\n" ;
# this prints out just fine.
open(OUTFILE, $outfile) || die ("System error -- could not open the
file that was created\n") ;
while (<OUTFILE>) {
$code = $_ ;
}
close(OUTFILE) ;
# now I'm opening the file that was written by the earlier program
print "authcode is $authcode\n" ;
# this doesn't print. Nothing after that open call will print to the
# screen.
I've opened and written and read files many times in perl programs,
I've never experienced this situation. At first I thought it was
because of the system call, which is why I redirected the output to
err.out. But then I realized that I was getting output after THAT, it
fails after the file open. So I'm confused. help!
Kathy
------------------------------
Date: Fri, 12 Feb 1999 11:40:33 -0600
From: "David M. Lloyd" <david@inxpress.net>
Subject: Re: Unable to output after system call and opening another file
Message-Id: <36C46791.BE2E0DD6@inxpress.net>
> print "Content-type: text/html\n\n" ;
>
> $ret=system("Code.exe $infile >err.out" ) ;
>
> # this works fine... the err.out (zero length) is created, and the
> # text file that is supposed to be created by code.exe is getting
> # written just fine.
>
> print "retcode is $retcode\n" ;
Shouldn't it be '$ret', not '$retcode'?
> # this prints out just fine.
>
> open(OUTFILE, $outfile) || die ("System error -- could not open the
> file that was created\n") ;
>
> while (<OUTFILE>) {
> $code = $_ ;
> }
> close(OUTFILE) ;
>
> # now I'm opening the file that was written by the earlier program
>
> print "authcode is $authcode\n" ;
Didn't you just call it '$code', not '$authcode'? Or did you cut out
a few lines?
> # this doesn't print. Nothing after that open call will print to the
> # screen.
>
> I've opened and written and read files many times in perl programs,
> I've never experienced this situation. At first I thought it was
> because of the system call, which is why I redirected the output to
> err.out. But then I realized that I was getting output after THAT, it
> fails after the file open. So I'm confused. help!
Try putting '$| = 1;' at the top of your program. That's about all
I know!
--
===========================================================
David M. Lloyd mailto:david@inxpress.net
Administrator
Internet Express, Inc.
802 W. Broadway, Suite 0101
Madison, WI. 53713-1866
Voice: (608) 663-5555 http://www.inxpress.net
Fax: (608) 663-1818 mailto:admin@inxpress.net
Data: (608) 663-5551 mailto:support@inxpress.net
===========================================================
------------------------------
Date: Fri, 12 Feb 1999 11:13:06 -0800
From: "Micah G. Cook" <mgcook@ic.delcoelect.com>
Subject: Re: unique hashnames
Message-Id: <36C47D42.100@ic.delcoelect.com>
I was trying to dynamically create hashes:
$name is going to change each time thru the loop.
$$name{'status'} = "active" ;
#this is my problem,
essentially i created a hash of arrays, but i wanted
to create several hashes with different names
one for each name.
------------------------------
Date: 12 Feb 1999 17:26:19 GMT
From: psl@euclid.jpl.nasa.gov (Peter Scott)
Subject: Re: using perl to talk to oracle database
Message-Id: <7a1o7r$db3@netline.jpl.nasa.gov>
Perhaps your Comments variable contains a single quote.
Get and build DBI and DBD::Oracle so you can talk directly to the
database instead of these strange circumlocations. They work well,
and you won't have any problem getting the quoting right after that.
--
This is news. This is your | Peter Scott, NASA/JPL/Caltech
brain on news. Any questions? | (psl@euclid.jpl.nasa.gov)
Disclaimer: These comments are the personal opinions of the author, and
have not been adopted, authorized, ratified, or approved by JPL.
------------------------------
Date: Fri, 12 Feb 1999 17:53:52 GMT
From: syarbrou@nospam.enteract.com (Steve .)
Subject: x-perl what's that?
Message-Id: <36c46a2d.4934019@news.enteract.com>
I recently was given a perl program to play with from an outside
source, and when I pull it up in my browser, Netscape 3 shows it is
an x-perl app and doesn't know what to do with it. Any ideas on what
I need to look for to figure out what to change to avoid this? If you
run the program from the command line it just shows:
Content-type: text/html
Which is rather normal. Thanks.
Steve
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4880
**************************************