[9440] in Perl-Users-Digest
Perl-Users Digest, Issue: 3035 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 1 05:07:22 1998
Date: Wed, 1 Jul 98 02:00:22 -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 Wed, 1 Jul 1998 Volume: 8 Number: 3035
Today's topics:
[Q] Database Confusion <ryan@steelplan.com.au>
Re: Camel book examples and -w (Marc Haber)
Downloading/Testing Perl. Help! <gargoyle23@home.com>
Re: Downloading/Testing Perl. Help! <jwb79@mail.idt.net>
Re: File Upload - Need Help... <rra@stanford.edu>
Help: Perl-mailing with Swedish characters <s@s.se>
Re: Help: Perl-mailing with Swedish characters <rra@stanford.edu>
Re: how to know the limit of a perl array? <bob.stutes@mosby.com>
Re: ICE - Search engine <jbrackman@hotmail.com>
Installing perl5004 binary IRIX 6.2 = "bad product" <ismkoehlerism@nmism-us.campus.mci.net>
Re: Is perl5-porters closed to subscription? (Mike Heins)
Migration from Msql to Oracle <scgyong@dev.bbcom.co.kr>
Re: newbie: trying to remove unwanted data from an arra <"postmaster"@[127.0.0.1]>
perl and environment parameters?? <abcdm@wanadoo.fr>
perl cgi and Java <mschnorr@eeyore.stcloudstate.nospam.edu>
Re: perl newbie Q: Any ideas why this doesn't work? (Jeffrey Kaplan)
Re: perl newbie Q: Any ideas why this doesn't work? <quednauf@nortel.co.uk>
Re: PUZZLE: dutree (old) <metcher@spider.herston.uq.edu.au>
Re: readdir sort by date in Perl? (Smith and O'Halloran)
Re: Replacing "stuff" via Regex... HELP! <bob.stutes@mosby.com>
Running Unix Script in Perl <steve.leach@virgin.net>
Re: Title Caps (Ron Glick)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 01 Jul 1998 12:00:00 +0800
From: Ryan Snowden <ryan@steelplan.com.au>
Subject: [Q] Database Confusion
Message-Id: <3599B440.C5B9E60@steelplan.com.au>
--------------EF2C0E3485B5D758BC3FF307
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
This question may span beyond the scope of perl and into the realm of
unix, but since I'm familiar with using Perl and Perl can be used for
database work, I'd ask here.
What I want.
Intranet, run off an Apache Web Server, in which perl/CGI scripts exist
and handle all 'submit's and do all the dirty work. Everything that
gets sent out or received through this web system (which relies on
sendmail basically) has to be logged, and recalled for reports.
Getting Down To It.
I want to store a number of variables in a database. These range from 4
digit numbers, to entire messages (which may span many lines - like the
body of an email message).
Now, I can use %hash's to store this information, then dump it into a
.db file using dbopen & dbclose. How efficient is it to have a large
message body dumped into a .db file? This .db file will basically
contain all email messages sent, which will later be searched through,
read and reports generated from it.
I know under unix there is a package called PostGresSQL... It handles
SQL type queries. There are modules which perl can use to write to this
SQL server in order to store information (I understand - just looking at
www.perl.com). I can make this server available you see, and wonder if
it's more efficient/smarter/easier to use this, than using %hash's
writing to DB files.
A little confused on how to do this.
Ryan Snowden
--------------EF2C0E3485B5D758BC3FF307
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
<FONT FACE="Courier New,Courier">This question may span beyond the scope
of perl and into the realm of unix, but since I'm familiar with using Perl
and Perl can be used for database work, I'd ask here.</FONT><FONT FACE="Courier New,Courier"></FONT>
<P><FONT FACE="Courier New,Courier">What I want.</FONT>
<BR><FONT FACE="Courier New,Courier">Intranet, run off an Apache Web Server,
in which perl/CGI scripts exist and handle all 'submit's and do all the
dirty work. Everything that gets sent out or received through this
web system (which relies on sendmail basically) has to be logged, and recalled
for reports.</FONT><FONT FACE="Courier New,Courier"></FONT>
<P><FONT FACE="Courier New,Courier">Getting Down To It.</FONT>
<BR><FONT FACE="Courier New,Courier">I want to store a number of variables
in a database. These range from 4 digit numbers, to entire messages
(which may span many lines - like the body of an email message).</FONT><FONT FACE="Courier New,Courier"></FONT>
<P><FONT FACE="Courier New,Courier">Now, I can use %hash's to store this
information, then dump it into a .db file using dbopen & dbclose.
How efficient is it to have a large message body dumped into a .db file?
This .db file will basically contain all email messages sent, which will
later be searched through, read and reports generated from it.</FONT><FONT FACE="Courier New,Courier"></FONT>
<P><FONT FACE="Courier New,Courier">I know under unix there is a package
called PostGresSQL... It handles SQL type queries. There are
modules which perl can use to write to this SQL server in order to store
information (I understand - just looking at www.perl.com). I can
make this server available you see, and wonder if it's more efficient/smarter/easier
to use this, than using %hash's writing to DB files.</FONT><FONT FACE="Courier New,Courier"></FONT>
<P><FONT FACE="Courier New,Courier">A little confused on how to do this.</FONT>
<BR><FONT FACE="Courier New,Courier">Ryan Snowden</FONT></HTML>
--------------EF2C0E3485B5D758BC3FF307--
------------------------------
Date: Wed, 01 Jul 1998 08:41:56 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Camel book examples and -w
Message-Id: <6ncspj$qed$5@nz12.rz.uni-karlsruhe.de>
Tom Christiansen <tchrist@mox.perl.com> wrote:
>The compiler doesn't look inside strings for this. Patches welcome.
Unfortunately, I don't have the expertise to make a patch for that. I
suggest, however, that this "quirk" finds its way into the
documentation.
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: Wed, 01 Jul 1998 05:48:12 GMT
From: "Linus Gian" <gargoyle23@home.com>
Subject: Downloading/Testing Perl. Help!
Message-Id: <w4km1.125928$Kx3.26084800@news.rdc1.sdca.home.com>
I am a Windows 95 user who wants to begin learning Perl 5.0.
When i wanted to learn Java, I just downloaded JDK and could begin writing
applets. No problem!
I am having a devil of a time doing the same with Perl.
Please, someone write a step-by-step way I can run/test Perl scripts from my
home computer.
TIA (Thanks in Advance)
------------------------------
Date: 1 Jul 1998 06:46:39 GMT
From: "jim babbington" <jwb79@mail.idt.net>
Subject: Re: Downloading/Testing Perl. Help!
Message-Id: <01bda4bb$20b42b40$6488fdc7@dixon>
> I am a Windows 95 user who wants to begin learning Perl 5.0.
>
> When i wanted to learn Java, I just downloaded JDK and could begin
writing
> applets. No problem!
>
> I am having a devil of a time doing the same with Perl.
>
> Please, someone write a step-by-step way I can run/test Perl scripts from
my
> home computer.
>
> TIA (Thanks in Advance)
Unless your having abnormally complex problems, you should be able to:
1) download the perl for win32s (binary + source)
2) Unzip and untar the file (you'll need gnu gzip & tar
http://www.cygnus.com) No win95/nt machine should be without these.
3) run the INSTALL.BAT.
4) reply to the prompts - best to put perl in a directory like c:\perl
5) make sure that c:\perl\bin is in your path <--- often overlooked
6) type perl -V and hit enter - this should display perl version
gobly-gook.
Extra credit:
7) using explorer/file types - make sure that extntions of .pl are
associated
to c:\perl\bin\perl.exe %1 %* on the OPEN function.
Extra Extra credit:
8) Add a cuntion in file types for edit - that will call up your favorite
perl script
in your favorite editor, or notepad (YECH!).
No compiling should be immediately necessary, however, if you must, Iv'e
only been
able to get it to work with Borlands BC5.xx
Let me know if this doesn't work...
Jim
Chat room philosophy:
Why?
>Why not?
Because!
>Oh.
------------------------------
Date: 30 Jun 1998 22:04:07 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: File Upload - Need Help...
Message-Id: <m3ww9yqi0o.fsf@windlord.Stanford.EDU>
Nick Forte <webmaster@triologic.com> writes:
> Thanks. I'm kinda new to PERL, so bare with me. What's the difference if
> I have a PERL file create and write to a file on the server (which I can
> do) or if I have upload it from a user's PC? Both ways are entrusting
> the PERL script to handle it.
I have no idea what the difference is because I don't know what you mean
by "upload" in this context. A Perl script that handles file upload *is*
doing nothing more or less than creating and writing to a file.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Wed, 01 Jul 1998 09:12:22 +0200
From: j <s@s.se>
Subject: Help: Perl-mailing with Swedish characters
Message-Id: <3599E156.26DF@memo.volvo.se>
I have a webpage that are used to send e-mails through a perl-script.
The script use sendmail, and the mail is sent with MIME-headers:
print MAIL "MIME-version: 1.0\n";
print MAIL "Content-Type: text/plain;charset=iso-8859-1\n";
print MAIL "Content-Transfer-Encoding: 8bit\n\n";
The body of the mail handles swedish characters without problems, but
the title looks like crap if it holds any non a-z characters. Eg:
VDXELSTOPP turns into =?iso-8859-1?q?V=C4XELSTOPP?=
(If your newsserver freaks out aswell, there is an A with two dots above
it between V and XELSTOPP! :)
Anyone who have seen this before, and possibly have a sollution for my
titleproblem?
Regards, Bod
------------------------------
Date: 01 Jul 1998 00:37:27 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Help: Perl-mailing with Swedish characters
Message-Id: <m37m1yowco.fsf@windlord.Stanford.EDU>
j <s@s.se> writes:
> I have a webpage that are used to send e-mails through a perl-script.
> The script use sendmail, and the mail is sent with MIME-headers:
> print MAIL "MIME-version: 1.0\n";
> print MAIL "Content-Type: text/plain;charset=iso-8859-1\n";
> print MAIL "Content-Transfer-Encoding: 8bit\n\n";
> The body of the mail handles swedish characters without problems, but
> the title looks like crap if it holds any non a-z characters. Eg:
> VDXELSTOPP turns into =?iso-8859-1?q?V=C4XELSTOPP?=
Headers of mail messages are not allowed to be eight bit, even with a
Content-Transfer-Encoding header, since the headers are only allowed to
affect the body. According to the mail standards, you have to *always*
encode the headers into seven bit data.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Wed, 01 Jul 1998 00:42:49 -0500
From: Robert Stutes <bob.stutes@mosby.com>
Subject: Re: how to know the limit of a perl array?
Message-Id: <3599CC59.1FF55617@mosby.com>
This is a multi-part message in MIME format.
--------------A2E93AA0809B41F3210FDB49
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
The key to remember here is that perl arrays are dynamic. That is they
grow as new data are added to the array.
As the Camel book states, the only limit to the size of an array is tha
amount of memory in your machine or (in more pragmatic terms) the limit
on the amount of memory a single process can consume (on versions of
UN*X where the Sys Admin can assign such limits).
Yongyan Wang wrote:
>
> In perl, the array can be assigned without pre-assigning its subscript limit,
> like $var[100]="value";
>
> How can I know the limit of the subscript of the variable? Practically, can I do the following $var[1000000000000000000000000]="value"; ?
>
> Thanks,
>
> Yongyan
--------------A2E93AA0809B41F3210FDB49
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Robert Stutes
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Robert Stutes
n: Stutes;Robert
org: Mosby Mathew Bender
adr: 1220 N. Lindbergh;;;St. Louis;Missouri;63132;USA
email;internet: bob.stutes@mosby.com
title: Technical Support Specialist
tel;work: 1-314-453-4369
tel;fax: 1-314-453-4120
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------A2E93AA0809B41F3210FDB49--
------------------------------
Date: Wed, 01 Jul 1998 07:23:34 GMT
From: "Jason" <jbrackman@hotmail.com>
Subject: Re: ICE - Search engine
Message-Id: <Wtlm1.2320$606.12187433@news.rdc1.ab.wave.home.com>
Hello Christopher,
Thank you for response. I had though that the Aliases would probably have
something to do with the correct mapping of directories... but so far it is
still not working.
$docroot = '\program files\xitami\webpages\database\upload';
%aliases = (
'/upload', '\program files\xitami\webpages\database\upload',
'/eng3x', '\program files\xitami\webpages\database\upload/eng3x',
'/eng1x', '\program files\xitami\webpages\database\upload/eng1x',
);
This is what I have in that section... unfortunately, the webpages are all
indexed properly but the links are not produced correctly. I would get
something like:
english.dyn.ml.org/log.htm
when it should really say
english.dyn.ml.org/database/upload/log.htm
Any further assistance would be appreciated.
Thanks again,
Jason
Christopher Paul wrote in message <6na53i$3rt$1@newton.a2000.nl>...
>
>
>hi jason,
>
>you need to set the 'aliases' hash properly..
>
>something like:
>
>%aliases = {
> "/usr/web/folder/database" , "/database"
>}
>
>or maybe the alias goes first, then the server path.. you
>can work it out from the example %aliases hash that
>christian provides in the script.
>
>Jason wrote in message
>
>>IE: 1) completes a search for a page that is located in
>>www.wherever.com/database/link.htm
>>
>> 2)Produces the result www.wherever.com/link.htm
>>
>
>
>
------------------------------
Date: Wed, 1 Jul 1998 00:09:24 -0600
From: "Rick K" <ismkoehlerism@nmism-us.campus.mci.net>
Subject: Installing perl5004 binary IRIX 6.2 = "bad product"
Message-Id: <6ncjqk$6ju$1@news.campus.mci.net>
Perhaps I can't see the forest for the trees, but I"m having problems
installing the "latest" perl 5.004 pre-compiled binary for SGI IRIX 6.2.
The file: perl5.004-6.2-shrp.tardist from typical source
The method used: inst -f filename
The results: "ERROR: The product perl5.004-6.2-shrp.tardist is bad"
Has anyone else encountered the same problem? Has anyone else
figured out a solution? Should I be wearing my dunce cap?
Tried the GUI inst method, too; same non-results.
Tried emailing provider of binary; got quick response (!), but the
response was basically "Is your computer plugged in?" or
something equally non-helpful.
AtDhVaAnNkCsE, Rick K. - print chr(7) . "JAPOTRTP\n";
--
Remove all "ism" from address if replying.
------------------------------
Date: 1 Jul 1998 01:04:53 -0500
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Is perl5-porters closed to subscription?
Message-Id: <3599c375.0@news.one.net>
Jeremy D. Zawodny <jzawodn@wcnet.org> wrote:
> Quentin Fennessy <quentin@shaddam.amd.com> writes:
>> Is perl5-porters closed to subscription?
> I don't think so.
I could see why someone might think so. I tried to subscribe a few
months ago and never was passed through.
I find mailing to perlbug@perl.com and a DejaNews subscription
to perl-porters.gw a good alternative, though.
Regards,
Mike Heins
------------------------------
Date: Wed, 01 Jul 1998 13:55:03 +0900
From: "Kim, Ki-Yong" <scgyong@dev.bbcom.co.kr>
Subject: Migration from Msql to Oracle
Message-Id: <3599C127.D2AC0C9E@dev.bbcom.co.kr>
I am making some CGI program with Msql on my PC-Linux machine,
and the program is to be used on a commercial Unix(Avignon?) which
Oracle database is running on.
Does my program work well when installed on that computer?
I am using these interface:
use Msql;
$dbh = Msql->connect("", "dbname");
$sth = $dbh->query("SELECT * FROM tblUser WHERE username='foo'");
while ((%hash = $sth->fetchhash) != NULL) {
# do something with %hash
}
If there is something I have to know, please let me know.
Thanks in advance.
- scgyong@nownuri.net -
ps. I'm not good at English.
------------------------------
Date: Wed, 01 Jul 1998 01:00:40 -0500
From: Bobn <"postmaster"@[127.0.0.1]>
Subject: Re: newbie: trying to remove unwanted data from an array....
Message-Id: <6ncj18$kbs$1@supernews.com>
Chad Thatcher wrote:
>
> Steve Neuharth wrote:
> >
> > O.k. I KNOW there's an easy answer to this.... I can't seem to find it
> > anywhere....
> > I've got an array (@rawoutput). I only need the lines that contain
> > "SUB-TOTAL:".... I'm trying some thing like this.....
> > $x=0;
> > for ($y=0;$y <= @rawoutput; $y++){
> > if (@rawoutput[$y] =~ /SUB-TOTAL:/) {
> > @output[$x] = @rawoutput[$y];
> > $x++;
> > }
> > }
> > @output never seems to populate with data (not sure why).
WARNING: I haven't tested this, but I think, you should use:
$output[$x] = $rawoutput[$y];
When an element of an array is pointed to, it's a scalar.
------------------------------
Date: 1 Jul 1998 06:33:28 GMT
From: "DUTOIT" <abcdm@wanadoo.fr>
Subject: perl and environment parameters??
Message-Id: <01bda4ba$5b2278a0$e9bffcc1@SIT.wanadoo.fr>
Hello,
I want to know all the environment parameters like PATH wich are used like
that:
$oldPATH=$ENV{"PATH"};
For example, I'm looking for how to know the current directory.
More,I want to use secured payment online (SSL). I'm looking for how to
put https://... instead of http://...
If you know some examples or some links about them, please send me them.
Best regards
DUTOIT
------------------------------
Date: Wed, 01 Jul 1998 00:57:37 -0500
From: Mike Schnorr <mschnorr@eeyore.stcloudstate.nospam.edu>
Subject: perl cgi and Java
Message-Id: <3599CFD0.34E7B678@eeyore.stcloudstate.nospam.edu>
--------------B859CAA20B892B44EF3721B0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I am attempting to write a perl CGI script which prints out a bunch of
HTML stuff, then calls
a java program which prints out a bunch more stuff, and then the perl
script should print
out some more HTML stuff. This is all supposed to end up in a pretty
little web page.
What Doesn't work
I tried using exec and system to call my java application i.e.
exec("\x\y\z\java...\java TestProgram");
This seemed to work from the command line, except exec never returning
from the called function is
not what I am looking for, system() seems to be the logical replacement.
When run under netscape I get a server error, and yes I do put out the
right header line and
my perl code is executable and all that good stuff (I'm not a complete
idiot).
output from command line execution
.../WWW/cgi-bin> new.pl
Content-Type: text/html
here in perl
got HERE in Java program!!!
here in perl again
.../WWW/cgi-bin>
I also tried calling a bourne shell script which spit out some output
and it seems
to work when called from the command line, but in a web page it looks as
if it
has never been called.
What does work
If I # out the call to the java program I get the output I would expect
in my web page:
here in perl here in perl again
Why I want to do this
I wan to use perl for all of my CGI parameter parsing but I have some
business logic
in a java application that I really do not want to rewrite in perl. So
the logical choice
seemed to be to do my parameter parsing and most of the HTML file output
in
perl (thing perl's is very good at) and then call my java application
from inside perl to
run my business logic.
Any suggestions or comments would be appreciated sorry to be so long
winded, I hope
this all makes sense (I am working way past my bedtime).
Thanks in advance
Mike
--------------B859CAA20B892B44EF3721B0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
I am attempting to write a perl CGI script which prints out a bunch of
HTML stuff, then calls
<BR>a java program which prints out a bunch more stuff, and then the perl
script should print
<BR>out some more HTML stuff. This is all supposed to end up in a pretty
little web page.
<P><FONT SIZE=+1>What Doesn't work</FONT>
<P>I tried using exec and system to call my java application i.e. exec("\x\y\z\java...\java
TestProgram");
<P>This seemed to work from the command line, except exec never returning
from the called function is
<BR>not what I am looking for, system() seems to be the logical replacement.
<P>When run under netscape I get a server error, and yes I do put out the
right header line and
<BR>my perl code is executable and all that good stuff (I'm not a complete
idiot).
<P>output from command line execution
<P>.../WWW/cgi-bin> new.pl
<BR>Content-Type: text/html
<P>here in perl
<BR>got HERE in Java program!!!
<BR>here in perl again
<BR>.../WWW/cgi-bin>
<P>I also tried calling a bourne shell script which spit out some output
and it seems
<BR>to work when called from the command line, but in a web page it looks
as if it
<BR>has never been called.
<P><FONT SIZE=+1>What does work</FONT>
<BR>If I # out the call to the java program I get the output I would expect
in my web page:
<P>here in perl here in perl again
<BR><FONT SIZE=+1></FONT> <FONT SIZE=+1></FONT>
<P><FONT SIZE=+1>Why I want to do this</FONT>
<BR>I wan to use perl for all of my CGI parameter parsing but I have some
business logic
<BR>in a java application that I really do not want to rewrite in perl.
So the logical choice
<BR>seemed to be to do my parameter parsing and most of the HTML file output
in
<BR>perl (thing perl's is very good at) and then call my java application
from inside perl to
<BR>run my business logic.
<P>Any suggestions or comments would be appreciated sorry to be so long
winded, I hope
<BR>this all makes sense (I am working way past my bedtime).
<P>Thanks in advance
<BR>Mike</HTML>
--------------B859CAA20B892B44EF3721B0--
------------------------------
Date: Wed, 1 Jul 1998 07:01:57 GMT
From: jkapllan@world.std.com (Jeffrey Kaplan)
Subject: Re: perl newbie Q: Any ideas why this doesn't work?
Message-Id: <359cdd72.96030967@news-f.std.com>
Drifting in hyperspace, I had plenty of time to read this memoir from
F.Quednau:
; > #!/usr/bin/perl5 -w
; > $pi = 3.141592654;
; > $result = 2 * $pi * 12.5;
; > print "radius 12.5 is circumference $result\n";
; >
; That script works on my machine...
It doesn't here.
; > #!/usr/bin/perl5 -w
; > $i=0
; > if $i<100
; > {print "it, ";
; > $i++}
; > else print "\n";
;
; This script will never work like that.
I understand. But I'm not even getting an error message. +That's+ the
problem as I see it.
; perl -v
;
; This is perl, version 5.003 with EMBED
; built under hpux at Nov 21 1996 13:03:00
; + suidperl security patch
;
; Copyright 1987-1996, Larry Wall
Mine says essentially the same. Only difference is mine says "built
under irix" with a different compilation date.
--
Jeffrey Kaplan <*> I'm set up for PGP. Are you?
jkapllan@world.std.com <*> There's only one "l" in my name.
There is no need to copy to me via email a newsgroup follow-up.
The World does not necessarily agree with my opinions.
Last week, I went to a furniture store to look for a decaffeinated
coffee table. They couldn't help me. (Steven Wright)
------------------------------
Date: Wed, 01 Jul 1998 09:44:09 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: perl newbie Q: Any ideas why this doesn't work?
Message-Id: <3599F6D9.DC037042@nortel.co.uk>
Jeffrey Kaplan wrote:
>
> ; perl -v
> ;
> ; This is perl, version 5.003 with EMBED
> ; built under hpux at Nov 21 1996 13:03:00
> ; + suidperl security patch
> ;
> ; Copyright 1987-1996, Larry Wall
>
> Mine says essentially the same. Only difference is mine says "built
> under irix" with a different compilation date.
That is, you have a shell open, and you type perl -v and then it comes out with
a similar message as above? But if you try to execute a script, nothing comes?
How are you trying to execute those programs?
I am by no means knowledgeable in the UNIX world, but here is my wildguess:
1. Your shell doesn't support the shebang line (#!)
=> start the file with 'perl myscript.pl'. This also works
if your file isn't set to be excutable...see next point
2. Your script isn't set to be excutable, but you are assuming it (OUCH!)
=> set your file to be executable (man chmod)
These were things I could reproduce on my machine. If it still doesn't work
then, you will need the help of someone else.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Wed, 01 Jul 1998 14:20:48 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: PUZZLE: dutree (old)
Message-Id: <3599B920.8310E393@spider.herston.uq.edu.au>
The only hash I can see in this program is the one referred to by *kid,
which has a name given by the first line of output from du. But I can't
see where %kid is used, only @kid.
Another question (the first being, "Huh?"):
Is
local($root, *kid, $him) = @_[0,0];
a shorthand for
local $root = $_;
local *kid = $_;
local $him;
?
--
Jaime Metcher
Tom Christiansen wrote:
>
> What is the name of the hash table being used by this program?
>
> #!/usr/bin/perl
> # dutree-orig: the old version pre-perl5 (early 90s)
>
> @lines = `du @ARGV`;
> chop(@lines);
> &input($top = pop @lines);
> &output($top);
> exit;
>
> sub input {
> local($root, *kid, $him) = @_[0,0];
> while (@lines && &childof($root, $lines[$#lines])) {
> &input($him = pop(@lines));
> push(@kid, $him);
> }
> if (@kid) {
> local($mysize) = ($root =~ /^(\d+)/);
> for (@kid) { $mysize -= (/^(\d+)/)[0]; }
> push(@kid, "$mysize .") if $size != $mysize;
> }
> @kid = &sizesort(*kid);
> }
>
> sub output {
> local($root, *kid, $prefix) = @_[0,0,1];
> local($size, $path) = split(' ', $root);
> $path =~ s!.*/!!;
> $line = sprintf("%${width}d %s", $size, $path);
> print $prefix, $line, "\n";
> $prefix .= $line;
> $prefix =~ s/\d /| /;
> $prefix =~ s/[^|]/ /g;
> local($width) = $kid[0] =~ /(\d+)/ && length("$1");
> for (@kid) { &output($_, $prefix); };
> }
>
> sub sizesort {
> local(*list, @index) = shift;
> sub bynum { $index[$b] <=> $index[$a]; }
> for (@list) { push(@index, /(\d+)/); }
> @list[sort bynum 0..$#list];
> }
>
> sub childof {
> local(@pair) = @_;
> for (@pair) { s/^\d+\s+//g; s/$/\//; }
> index($pair[1], $pair[0]) >= 0;
> }
> --
> "It is easier to port UNIX to a new machine, than an application to a new
> operating system." -- Dennis Ritchie
------------------------------
Date: 1 Jul 1998 01:12:02 -0700
From: inwap@best.com (Smith and O'Halloran)
Subject: Re: readdir sort by date in Perl?
Message-Id: <6ncr0i$hek$1@shell3.ba.best.com>
In article <MPG.1002272fcb33d797989702@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>As you make clear in your script, it works for files in the current
>directory only, not in general. Perhaps that is the issue Tom C is
>raising.
Right. The code I posted was a snippet from a routine that did a chdir()
first and then used "." as the arugment to opendir(). If the function
was called with any argument other than ".", it would fail.
>> In article <6n9632$l9$2@csnews.cs.colorado.edu>,
>> Tom Christiansen <tchrist@mox.perl.com> wrote:
>> >: foreach $_ (grep(!/^\./,readdir(DIR))) { # Skip dot files
>> >: ($size{$_},$date{$_}) = (stat $_)[7,9];
>> >
>> >That code is incorrect. You forgot what readdir returns, or
>> >what stat wants, or both.
(Sound of man smacking himself in the forehead: D'oh!)
My mistake. I must fix that. The directory name needs to be included
in the stat() call.
sub read_dir { # Read directory, set %size, %date and $namewidth
my($dir) = shift;
opendir(DIR,$dir) || die "Cannot read directory $dir: $!\n";
foreach $_ (grep(!/^\./,readdir(DIR))) { # Skip dot files
($size{$_},$date{$_}) = (stat "$dir/$_")[7,9];
}; closedir(DIR);
}
-Joe
--
INWAP.COM is Joe and Sally Smith, John and Chris O'Halloran and our cats
See http://www.inwap.com/ for "ReBoot", PDP-10, and Clan MacLeod.
------------------------------
Date: Wed, 01 Jul 1998 01:10:26 -0500
From: Robert Stutes <bob.stutes@mosby.com>
Subject: Re: Replacing "stuff" via Regex... HELP!
Message-Id: <3599D2D2.8C6DA23E@mosby.com>
This is a multi-part message in MIME format.
--------------7DF162B4BBFB516B947ACBA7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I realize this is fairly simple minded (and not very elegant) but you
could try breaking comma delimited string up into an array of tokens and
then test each token in the array for the presence of a '"'. If you
find a quoted token, nuke it from the array.
Consider the following code:
#!/usr/local/bin/perl
$words='data,data,data,number,text,"string",data,
stuff,"nuther",stuff,text,"two words",text,"last words"';
@words=split(',',$words);
print "$words\n";
for($i = 0; $i <= $#words; $i++) {
if($words[$i] =~ /"/) {
splice(@words,$i,1);
}
}
print join(',', @words),"\n";
Like I said, not elegant, but it works!
Bob S.
Mike Cisar wrote:
>
> Appologies if this has been posted before/recently... but I've been
> hammering my head up against the wall for hours trying to write a Regex
> that will take the input string (a comma delimited line from a
> spreadsheet) and remove any fields that are quoted. There may be zero
> or more fields which are quoted and must be nuked.
>
> ie. if the input line was
> data,data,data,number,text,"string",data, stuff,"nuther",stuff,text,"two
> words",text
> the output would be
> data,data,data,number,text,,data, stuff,,stuff,text,,text
> still leaving the commas as the field separator, but removing any and
> all fields that are quoted (so in this case we nuke "string" "nuther"
> and "two words")
>
> I'm sure this is just a problem of "I've been looking at this too
> long"... any help is *GREATLY* appreciated.
>
> Thanks,
> >>>>> Mike <<<<<
--------------7DF162B4BBFB516B947ACBA7
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Robert Stutes
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Robert Stutes
n: Stutes;Robert
org: Mosby Mathew Bender
adr: 1220 N. Lindbergh;;;St. Louis;Missouri;63132;USA
email;internet: bob.stutes@mosby.com
title: Technical Support Specialist
tel;work: 1-314-453-4369
tel;fax: 1-314-453-4120
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------7DF162B4BBFB516B947ACBA7--
------------------------------
Date: Wed, 01 Jul 1998 08:47:20 +0100
From: Steve Leach <steve.leach@virgin.net>
Subject: Running Unix Script in Perl
Message-Id: <3599E988.3146@virgin.net>
Is it possible to run a unix script from within a perl script.
If so HOW ? (its got me stuck).
Thanks
Steve
------------------------------
Date: Tue, 30 Jun 1998 18:20:41 GMT
From: rglick@liii.com (Ron Glick)
Subject: Re: Title Caps
Message-Id: <6nba3s$be7$1@cedar.liii.com>
In article <359831C3.45E05923@westaff.com>, Richard Remington <rremington@westaff.com> wrote:
>I've been working on a something I'm sure someone has done before. I'm
>pulling ascii data from an Oracle database using DBI. The data I get is
>sometimes all caps, sometimes lower case, and sometimes title caps. I
>want to convert everything to lower case and then convert to title caps.
<snip>
Richard,
Try this code. It uses the offset parameter of the index function to
continuously loop through all the spaces in the string. It assumes that you
want the first letter and every letter after a space capitalized. It also
assumes you haven't messed with $[ (and God help you if you have).
$scalar="\u\L$scalar";
$last=0;
while (1) {
$space_pos=index($scalar,' ',$last);
last if ($space_pos == -1);
substr($scalar,($space_pos+1),1) =~ tr/a-z/A-Z/;
$last=$space_pos+1;
}
I'm almost certain that you could do this with some much more compact regular
expression, but I haven't grokked that whole subject yet. This took me a
couple of minutes, it works, and I think it's at least fairly readable.
HTH,
Ron Glick
------------------------------
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 3035
**************************************