[9288] in Perl-Users-Digest
Perl-Users Digest, Issue: 2883 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 16 12:17:22 1998
Date: Tue, 16 Jun 98 09:00:32 -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 Tue, 16 Jun 1998 Volume: 8 Number: 2883
Today's topics:
Re: A hash question <aqumsieh@matrox.com>
Re: Benchmark module in Perl for Win32 greene@gucc.org
C_"permutations algorithm" <buyanovs@sgci.com>
Re: Calculating Disk Space on Win32 scott@softbase.com
Re: Certified Perl Programmers <merlyn@stonehenge.com>
Re: Certified Webmasters <jdporter@min.net>
Re: Curly braces in if elsif contructs (Michael J Gebis)
fixed width files into an array ? <cbeatson@mail.ci.lubbock.tx.us>
Re: getting first letter of a string <barnett@houston.Geco-Prakla.slb.com>
Re: HELP WITH SOME NEWBIE HACKED CODE??? <barnett@houston.Geco-Prakla.slb.com>
Re: HELP WITH SOME NEWBIE HACKED CODE??? greene@gucc.org
Re: Help with using Time in PERL <barnett@houston.Geco-Prakla.slb.com>
HELP: Perl Scripts for a unix host using Apache (Christian Friedl)
Re: How can I run Perl in Microsoft Access ? <warp@internetcom.com.br>
How to read from registry: GetValue or QueryValue??? <aol@sorona.se>
Re: I need a simple scrip that... <robsmith@writeme.com>
insert - quick script jon@blading.com
Re: lambda fun in Perl <jdporter@min.net>
Re: mailspinner.cgi <barnett@houston.Geco-Prakla.slb.com>
Multi-D Array Sorting pugs5@my-dejanews.com
Newbie looking for help with text manipulation (Christie, Sara)
Re: Newbie looking for help with text manipulation <quednauf@nortel.co.uk>
Re: Newbie looking for help with text manipulation (Christie, Sara)
Re: Newbie looking for help with text manipulation <quednauf@nortel.co.uk>
Re: Newbie question <tresing@globalscape.net>
Re: perl 5 on NT4 problems <stijf@hotmail.com>
Re: perl cgi generated html with java app "class not fo scott@softbase.com
Re: prob with *.txt file 6xtippet@CyberJunkie.com
Re: Problem with MOMSpider (Joe McMahon)
Re: Read a filename from a file and open it <aqumsieh@matrox.com>
Re: Running commands <rootbeer@teleport.com>
Re: Sending mail, can I set the $from ? <barnett@houston.Geco-Prakla.slb.com>
Re: Simple pattern matching problem <quednauf@nortel.co.uk>
Re: strange error message .. "value of <handle> ..." <merlyn@stonehenge.com>
Re: Use of DBD::Oracle from cron (John D Groenveld)
Re: Windows95, Perl-32 and Personal Web Server (PWS) <psattler@bestweb.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 16 Jun 1998 10:01:18 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: A hash question
Message-Id: <35867AAE.74CDC69B@matrox.com>
Paul Cameron wrote:
> I finally getting around to using hashes and I ran into this problem.
>
> I've got two arrays and I want to build a hash so that array1 will be
> the key and array2 will be the value. The way its set up now I'm only
> getting the last key,value pair I put in the hash. I just wondering if
> anyone has any ideas on how to make this work or is it just not
> possible. Here's some of the code.
>
> @names = "a bunch of names";
> @data = "info about those names";
>
Both of these arrays contain a single element only. Are you sure you want
that? maybe you would like to say:
@names = split /\s+/, "a bunch of names";
> $count = @data;
> for ($i = 0; $i < $count; $i++ ) {
> %info = ( "$names[$i]", "$data[$i]" );
That is not the way to populate a hash. You are overwriting your hash
with each loop.
> }
>
> Thanks for any help,
> paul
Assuming @names and @data contain the correct information, and are of
the same length,
for ($i=0; $i < $#data; $i++) {
$info{$names[$i]} = $data[$i];
}
If you don't care about @names and @data anymore, you might want to do
that:
foreach (@names) {
$info{$_} = shift @data;
}
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Tue, 16 Jun 1998 14:06:22 GMT
From: greene@gucc.org
Subject: Re: Benchmark module in Perl for Win32
Message-Id: <6m5u4t$66o$1@nnrp1.dejanews.com>
In article <35830F61.CB096B@stuttgart.netsurf.de>,
Jochen Froehlich <jf@stuttgart.netsurf.de> wrote:
>
> Hi everyone,
>
> I tried to 'use Benchmark' with Perl for Win32 Build 316 on NT and
> got the following message:
> [-message snipped-]
>
> The question is:
> How can 'Benchmark' be used with Perl for Win32 if 'times'
> is not implemented there (as the error message indicates)?
>
> Hope you can help. Thanks in advance!
>
Go to www.perl.com and get
Gurusamy Sarathy's distribution of Perl, version 5.004_02, which comes with
Win32 support -- Includes binaries for several useful Perl Modules
The 5.004 release offers several features over the ActiveWare 5.003, including
the perldoc utility, and many more 'standard' modules including Benchmark.
HTH,
JAGreene
--
# James Greene - Informatics Consulting - D-79539 Loerrach, Germany
# Internet: www.gucc.org/greene/consult - greene@gucc.org
# PGP Fingerprint: 8930 41E7 351B 56D8 801C D4D9 4C76 AF0F E24E F307
perl -we "$_=join'<',qw{d2by' f5e;f4z($iu w0@86yo=&ae b!097)l(&aa8vme
b$*};$_=unpack'u*',uc;print"
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 16 Jun 1998 07:25:23 -0700
From: "George Buyanovsky" <buyanovs@sgci.com>
Subject: C_"permutations algorithm"
Message-Id: <pgpmoose.199806160725.9818@servo>
/* Buyanovsky's permutations algorithm [1997]
Tab == 4
--------
Pentium II - 290 MHZ
12! == 479001600
combos 12
Ch=479001600 Time=30 sec.
15966720 permutations per/sec.
18.162778 machine cycles per one permutation
Compilation options for MS_VC_5.0:
/nologo /Gr /ML /W3 /GX /Ox /Ot /Oa /Ow /Og /Oi /Ob2 /D "WIN32"
/D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/combos.pch" /YX
/Fo"Release/" /Fd"Release/" /FD /c
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
typedef unsigned int word;
typedef struct TRR /* one-linked list item */
{ struct TRR *p; /* pointer to TRR */
word v; /* value {0....N-1}*/
} Tr_tag;
static word M,GNB,Ch=0; /* Ch & GNB & Gp - ONLY for Type() */
static Tr_tag *Gp;
void Type(void) /* Output function */
{ word i=0;
for(printf("\n#%-11u",Ch);i<GNB;i++) printf("%u ",(Gp+i)->v);
}
#define SW(a,b)
(word)(a)^=(word)(b);(word)(b)^=(word)(a);(word)(a)^=(word)(b)
#define OUTPUT ++Ch;/*Type()*/ \
g=p->p; SW(p->v,g->v);\
++Ch;/*Type()*/ \
SW(g->p,lp->p);SW(g->v,lp->v); p=p->p=lp;lp=g
static word N;
static Tr_tag *g;
/* R_Swop - permutations recursive function */
void R_Swop(Tr_tag *p)
{ Tr_tag *lp=p->p; p->p=lp->p; /* build a bridge */
if(N==3) { OUTPUT;OUTPUT;OUTPUT; }
else { word i=N--; /*'i' is recursive counter for k-knot of the N!-tree*/
do { R_Swop(p); /* exchange between 2 items of the list */
g=p->p;SW(g->p,lp->p);SW(g->v,lp->v);p=p->p=lp;lp=g;
}
while(--i);
++N;
}
lp->p=p->p;p->p=lp; /* destroy the bridge */
}
void MakeCombosA(word NB)
{ Tr_tag *p;
word i=NB,k=0;
if(!(Gp=p=calloc(i,sizeof(Tr_tag)))) return;
do {(p+--i)->v=i; (p+i)->p=p+k; k=i; } while(i); /* Initialisation */
N=GNB=NB;
R_Swop(p);
free(p);
}
void __cdecl main(word argc,char **argv)
{ time_t tm=time(NULL);
if(argc<2) {puts("?compos N");return;}
MakeCombosA(atoi(argv[1]));
printf("Ch= %-9u Time= %-9u sec.\n",Ch,time(NULL)-tm);
}
Best Regards
George Buyanovsky
ACB-compression author [1994..1998[
ACB-compressor ( Ziff-Davis 4-Star rating )
see:
http://www6.zdnet.com/cgi-bin/texis/swlib/hotfiles/info.html?fcode=000HR5
------------------------------
Date: 16 Jun 1998 12:01:35 GMT
From: scott@softbase.com
Subject: Re: Calculating Disk Space on Win32
Message-Id: <6m5mqv$ud2$2@mainsrv.main.nc.us>
Surface@my-dejanews.com wrote:
> Has anybody done any calculating of disk
> space on a Windows NT machine and can share their code?
I have never done it, but I do know that the DIR command
will tell you the amount of free disk space.
Something like:
650,379,264 bytes free
This information could be processed to tell you the amount
of disk space free on a given volume.
If you want something more specific than that, you'll likely
have to write a small C program to use the API to get at the
information, since Perl can't call arbitrary API functions yet.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: Tue, 16 Jun 1998 14:53:05 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Certified Perl Programmers
Message-Id: <8c7m2hjt4p.fsf@gadget.cscaper.com>
>>>>> "Nathan" == Nathan Torkington <gnat@frii.com> writes:
Nathan> Well, Randal would benefit. Randal isn't yet everyone, although I
Nathan> believe his ascendency to a ball of all-encompassing light is
Nathan> scheduled for 1Q 2004.
Ahh. I wondered where that extra night-light was coming from.
Durn thing's keeping me up at night.
:-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 77 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
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: Tue, 16 Jun 1998 14:32:40 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Certified Webmasters
Message-Id: <358683D3.4B4A@min.net>
Chris Nandor wrote:
>
> # have at least one certificate or degree (related to computer programming),
> # from a post secondary education institution
>
> Of course, a "post secondary education institution" is a completely
> irrelevant title. I can declare myself a "post secondary education
> institution" and give myself a degree. I can make myself an accrediting
> agency and accredit my institution. And it is every bit as worthless as
> the certification is, but it is still falls into their criteria as valid,
> of course.
This reminds me of the mail-order D.D. degrees one can get, which,
among other things, allow one to perform marriages.
Maybe that's the route the perl certifiers should take.
Priests of Perl are legally authorized to perform exorcisms of
evil bloatware, etc. etc.
Perhaps the Church can even get tax-exempt status.
Nathan Torkington wrote in <5qemwq4fhs.fsf@prometheus.frii.com>:
> I believe [Randal's] ascendency to a ball of all-encompassing light
> is scheduled for 1Q 2004.
A strange belief -- rather too Adventist for my tastes -- but not
exactly heretical.
John Porter
------------------------------
Date: 16 Jun 1998 14:24:32 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Curly braces in if elsif contructs
Message-Id: <6m5v70$4dq@mozo.cc.purdue.edu>
Any more mini-dilemmas I should know about? <jefpin@bergen.org> writes:
}I definitely agree. This DOES help readability (I code like this), and it
}doesn't matter that it's a "waste of space". In fact (oh, I'm evil), if I
}have if elsif else statements that are short enough, I even do:
}if ($this){ print "This"; }
}elsif ($that){ print "That"; }
}else{ print "The other thing"; }
}So maybe I'm evil too :)
You could at least do:
if ($this) { print "This"; }
elsif($that) { print "That;" }
else { print "The other thing";}
So yes, you are evil.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Tue, 16 Jun 1998 08:45:07 -0500
From: Chris Beatson <cbeatson@mail.ci.lubbock.tx.us>
Subject: fixed width files into an array ?
Message-Id: <358676E3.E7B1369D@mail.ci.lubbock.tx.us>
Could someone please advise me as to the best way to read a fixed width
text file line into an array ?
TIA
Chris
------------------------------
Date: Tue, 16 Jun 1998 09:11:30 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: Ritche Macalaguim <ritche@san.rr.com>
Subject: Re: getting first letter of a string
Message-Id: <35867D12.B3D7D30@houston.Geco-Prakla.slb.com>
[courtesy cc to cited author]
Ritche Macalaguim wrote:
>
> How can I get the first letter of a string in Perl?
You mean other than by using the 'substr' function?
perldoc -f substr
>
> Ritche
> ritche@san.rr.com
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: Tue, 16 Jun 1998 08:34:36 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: HELP WITH SOME NEWBIE HACKED CODE???
Message-Id: <3586746C.3C6C3B14@houston.Geco-Prakla.slb.com>
Subject: HELP WITH SOME NEWBIE HACKED CODE???
First, no need to shout, we can all read/hear perfectly well.
Stephan Carydakis wrote:
>
> Hi All,
>
> I have a quaestion about the following code:
>
<code snipped>
> My problem is with the last 'if' statement. What I think should happen
> is every time the condition is met(10 times all up), the script spews
> out '* ' to STDOUT.
>
> What actually happens is it spews out 10 '* ' all at once, and not 1 at
> a time as I would expect. Can someone tell me why this is so?
Second, sure.
You are probably running on an operating system that does blocked reads
& writes (read: more efficient disk accesses). You should have a look
at the $| variable, and the select() function (perldoc perlvar, and
perldoc -f select, respectively).
Before your call to 'get data', include these two lines:
select(STDOUT);
$| = 1;
This will then work as expected from the command line.
I notice comments about 'FORM' this, and 'FORM' that. From this, I'm
going to assume this is for a web page. The above may, or may not, make
any difference in this case. You'll just have to try it. I don't have
a web server where I can try such things.
HTH.
>
> Anyones help is much appreciated.
> ________________________________________________
> Stephan Carydakis steph@hotkey.net.au
>
> "Missed it by that much" -- Agent 86 of Control
> ________________________________________________
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: Tue, 16 Jun 1998 14:21:20 GMT
From: greene@gucc.org
Subject: Re: HELP WITH SOME NEWBIE HACKED CODE???
Message-Id: <6m5v0v$7aj$1@nnrp1.dejanews.com>
In article <3585437A.4D64@hotkey.net.au>,
steph@hotkey.net.au wrote:
>
> Hi All,
>
> I have a quaestion about the following code:
>
> [-code snipped-]
>
> My problem is with the last 'if' statement. What I think should happen
> is every time the condition is met(10 times all up), the script spews
> out '* ' to STDOUT.
>
> What actually happens is it spews out 10 '* ' all at once, and not 1 at
> a time as I would expect. Can someone tell me why this is so?
Yes, you are experiencing the wonders of buffered output.
perldoc perlvar
...
autoflush HANDLE EXPR
$OUTPUT_AUTOFLUSH
$| If set to nonzero, forces a flush right away and after every
write or print on the currently selected output channel.
Default is 0 (regardless of whether the channel is
actually buffered by the system or not; `$|' tells you
only whether you've asked Perl explicitly to flush after
each write). Note that STDOUT will typically be line
buffered if output is to the terminal and block buffered
otherwise. Setting this variable is useful primarily
when you are outputting to a pipe, such as when you are
running a Perl script under rsh and want to see the
output as it's happening. This has no effect on input
buffering. (Mnemonic: when you want your pipes to be
piping hot.)
HTH!
JAGreene
--
# James Greene - Informatics Consulting - D-79539 Loerrach, Germany
# Internet: www.gucc.org/greene/consult - greene@gucc.org
# PGP Fingerprint: 8930 41E7 351B 56D8 801C D4D9 4C76 AF0F E24E F307
perl -we "$_=join'<',qw{d2by' f5e;f4z($iu w0@86yo=&ae b!097)l(&aa8vme
b$*};$_=unpack'u*',uc;print"
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 16 Jun 1998 08:27:10 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Help with using Time in PERL
Message-Id: <358672AE.3075D44E@houston.Geco-Prakla.slb.com>
dgower@ibm.net wrote:
>
> Hello-
>
> I am trying to make a script that will rotate images depending on the day
> of the week(MON,TUE,etc). If anyone knows of a script like this that already
> exists let me know, if not I will keep trying, but maybe you can help me with
> this problem. When using the following
>
Are you using '-w'?
> use Time::gmtime;
> $gm = gmtime();
> printf "The day in Greenwich is %s\n",
> (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[ gm->wday() ];
Interesting.
When I run it as above, I get:
Unquoted string "gm" may clash with future reserved word at junk14 line
6.
Name "main::gm" used only once: possible typo at junk14 line 4.
Can't locate object method "wday" via package "gm" at junk14 line 5.
Changing the last line to read:
(qw(Sun Mon Tue Wed Thu Fri Sat Sun))[ $gm->wday() ];
gives the following output:
The day in Greenwich is Tue
<snip>
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: Tue, 16 Jun 1998 15:43:09 GMT
From: chrisf@xpoint.nospam.at (Christian Friedl)
Subject: HELP: Perl Scripts for a unix host using Apache
Message-Id: <35869278.17286507@news.xpoint.at>
Hi,
My problem is that I'm working on a Win95 machine at home and have to
write scripts for a unix host that doesn't show me any error messages
except "Internal Server Error".
On my machine, the scripts work fine.
The provider tells me they're using Apache. I am past the state of
forgetting to chmod 755, so this is not the problem. A simple script
like the following
>>>>
#!/usr/bin/perl
use CGI;
$q=new CGI;
print "<html><head>";
print "<title>WienSchall Index</title>\n";
print "</head><body>\n";
foreach $key ($q->param) {
print $key." ".$q->param($key)."<p>";
}
print "</body></html>";
print "\n\n";
<<<<<
doesn't work. Is it possible there are bugs in CGI.pm?
The strange thing is, that I successfully installed an adapted verson
of Matt's Simple Search script, which is rather complicated compared
to the above example.
No idea what's wrong there.
Chris
+++ MY HOMEPAGE +++
http://www.user.xpoint.at/chrisf
++++ Interpretationen, Exzerpte, Literatur, Kunst ++++
+++ ACHTUNG ANTISPAM-MASSNAHME !! +++
(leider notwendig, ich bitte fuer eventuelle
Unannehmlichkeiten um Entschuldigung)
+++ please remove ".nospam" when replying via email +++
------------------------------
Date: Tue, 16 Jun 1998 11:45:04 -0300
From: "BBQ" <warp@internetcom.com.br>
Subject: Re: How can I run Perl in Microsoft Access ?
Message-Id: <6m60do$9ca@www001.itanet.com.br>
I use Win32::ODBC, works great, and as it's name suggests its not olny for
Access but for ODBC systems in general.
You can get it from your local CPAN mirror. (Look for Dave Roth's modules)
Henry Ng wrote in message <3586557B.FCAFD5F9@email.sps.mot.com>...
>Hi,
> My name is Finie, how can I run Perl in Microsoft Access ?
>Regards
>Finie
------------------------------
Date: Tue, 16 Jun 1998 17:28:45 +0200
From: "Andreas Olsson" <aol@sorona.se>
Subject: How to read from registry: GetValue or QueryValue???
Message-Id: <35868eee.0@d2o26.telia.com>
Hello,
I have problem with reading a value from the registry. I want to read the
(string) value of 'OutFileName' wich is located in
HKEY_LOCAL_MACHINE/SOFTWARE/Sorona/IBSConv/. Here is my code:
use Win32::Registry;
# Open IBSConv Key
$HKEY_LOCAL_MACHINE->Open("SOFTWARE", $hkey) || die "Can't open registry";
$hkey->Open("Sorona", $skey) || die "Can't open registry";
$skey->Open("IBSConv", $lkey) || die "Can't open registry";
# Get value in IBSConv key with name
$lkey->QueryValue("OutFileName", $outfilename) || die "Can't find
OutFilename in Registry";
The problem is: this does not work!!! I've tried the GetValue function with
success but then I can't refer to 'OutFileName' by name but rather just to
an index in an array which holds the data for the entire IBSConv key. The
index to OutFileName changes if there is more values added under the IBSConv
key. So definetely I wan't to refer to the OutFileName value by name, not by
index in an array.
Thanks in advance
/Andreas Olsson, aol@sorona.se
------------------------------
Date: Tue, 16 Jun 1998 00:48:38 -0400
From: "Rob Smith" <robsmith@writeme.com>
Subject: Re: I need a simple scrip that...
Message-Id: <6m4tll$cjl$1@snoopy.uscsumter.edu>
Do a search for html tracking...
You will probably have to pay a fee, but you can use a javascript found at
www.javaboutique.com
There are tons out there... Just need to look...
>-> I need a simple script that will track my .html pages and tell me what
>-> traffic each are getting...and free woudl be nice:-)
>
------------------------------
Date: 16 Jun 1998 15:13:18 GMT
From: jon@blading.com
Subject: insert - quick script
Message-Id: <6m622e$s5a$1@usenet11.supernews.com>
hello
i'm trying to write a quick script that will insert a small bit of text
and a tab mark to the beginning of every line in a file. what i have is:
#!/usr/bin/perl -pi.bak
s/(\S+?)/text\t$1\t\n/g;
i've tried a bunch of variations, none successful. any ideas? if
possible, please cc my email. thanks.
--
Jon Nathan
jon@blading.com
http://www.rupture.net/~jon/
------------------------------
Date: Tue, 16 Jun 1998 14:18:22 GMT
From: John Porter <jdporter@min.net>
Subject: Re: lambda fun in Perl
Message-Id: <35868079.4D81@min.net>
Jan Krynicky wrote:
>
> John Porter wrote:
> >
> > You have to worry about side-effects in any case, if the
> > language permits them. If you really want to never have to
> > worry about side-effects, then you must restrict yourself to
> > language which don't allow them.
>
> With all the features you usualy get from them (eg. lazines)
> I wouldn't use the word "restrict".
"Restrict" is correct. I, for example, am restricting myself
to Perl only. That does not imply that Perl is restricting as
a language. Same with any other language or family of languages.
> I love functional languages, but for scripting, Perl is better.
O.k., for "scripting", Perl is better; but for "real
programming", Perl demonstrates itself to be weaker and
inferior to [your favorite language here].
This is why I never use the word "script" or "scripting" wrt
perl programming. Perl is no more a "scripting" language than
it is a CGI language.
John Porter
------------------------------
Date: Tue, 16 Jun 1998 08:42:43 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: mailspinner.cgi
Message-Id: <35867653.BFFB057F@houston.Geco-Prakla.slb.com>
redpeppa@my-dejanews.com wrote:
>
> if anyone has a copy of mailspinner.cgi plz email me..im 18 and i really
> cant afford paying $1,000 when all im looking for is a personal web email
> client...thanks
So, instead of writing one yourself, you've decided that propositioning
in a newsgroup of/for **programmers** for someone to 'give' you a copy
is a good idea?
'Forget about it'.
*plonk*
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: Tue, 16 Jun 1998 14:56:08 GMT
From: pugs5@my-dejanews.com
Subject: Multi-D Array Sorting
Message-Id: <6m6127$ats$1@nnrp1.dejanews.com>
I need help here.
I am trying to sort a multi-D array. It is basically an array inside of an
array. I am trying to sort the array inside.
For example.. I have
bytestohost{$i,$j} where I need to sort that for the same value of $i.
If anyone could help. Thanks a bundle!
Jason Pugsley
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 16 Jun 1998 13:53:09 GMT
From: Schristie@rnib.org.uk (Christie, Sara)
Subject: Newbie looking for help with text manipulation
Message-Id: <6m5tcf$9at$1@flex.london.pipex.net>
I have spent some time scouring through the FAQs for some help with
this but dont seem to be getting anywhere so I apologise if I have
missed something obvious and this is actually quite easy :-)
My problem is how to (if you can) identify a word after a tag, remove
the tag and put the word into a variable so that it can be inserted
into the text document again at regular intervals. This would occur
until the next tag wherupon the word would be updated.
The document is received like this:
<CATEGORY> Books
<SECTION> one
Title
Code
Description
Title
Code
Description
etc.
<SECTION> two
Title
Code
Description
and I would like it to be:
Books, one, title, code, descriptioin
Books, one, title, code, description
etc.
Books, two, title, code, description
I have managed to do the not too difficult job of reordering the title
code description by doing a simple substitution but am stumped as to
how to cope with the tagged bit.
Any help would be greatly appreciated,
------------------------------
Date: Tue, 16 Jun 1998 16:05:51 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Newbie looking for help with text manipulation
Message-Id: <358689CF.2A027CC2@nortel.co.uk>
>
> The document is received like this:
>
> <CATEGORY> Books
> <SECTION> one
maybe this would work:
s/^<.*> /$'/
The $' is supposed to contain the string after the matched string, up to the end
of the eval string. People, please correct if it's wrong.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Tue, 16 Jun 1998 15:37:47 GMT
From: Schristie@rnib.org.uk (Christie, Sara)
Subject: Re: Newbie looking for help with text manipulation
Message-Id: <6m63gk$g64$1@flex.london.pipex.net>
>The document is received like this:
><CATEGORY> Books
><SECTION> one
>Title
>Code
>Description
To confirm any queries...
The title, Code and Description are not literal, and the description
could be of multiple lines. However they are not tagged, and the
"keywords" (i.e. title, code, description) will not appear in the
document.
The records will be separated by a blank line, and there are actually
4 description fields to allow for up to 4 paragraphs of description.
There are several categorories and several sections within each
category. The categories and Sections are tagged as shown above.
I hope this clarifies the situation.
Many Thanks for the help I am receiving, I may get through this yet!!
------------------------------
Date: Tue, 16 Jun 1998 16:31:12 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Newbie looking for help with text manipulation
Message-Id: <35868FC0.76DE80F0@nortel.co.uk>
F.Quednau wrote:
>
> >
> > The document is received like this:
> >
> > <CATEGORY> Books
> > <SECTION> one
>
> maybe this would work:
>
> s/^<.*> /$'/
>
> The $' is supposed to contain the string after the matched string, up to the end
> of the eval string. People, please correct if it's wrong.
Which would end up with 'Books Books' if I am lucky. *sigh* I shall put my brain
to rest for today...
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Tue, 16 Jun 1998 09:33:00 -0500
From: Thomas Resing <tresing@globalscape.net>
To: Freek <freek@writeme.com>
Subject: Re: Newbie question
Message-Id: <3586821C.4A9350B3@globalscape.net>
Freek wrote:
> I am a newbie in the perl world. i curently have a simple problem, i
> hope.
> I need to display the images in a directory, directly on a web page,
> without having to hardcode the files into html, this would take to long
> to add pics. i have been unable to do this in javascript, and now, am
> having probs with perl doing it. the directory will only have images,
> and there will be a limited number of images per directory, but they
> will change periodically.
>
> if this script exsists i have been unable to find it.
>
> any help is apprieciated.
>
> please, if possible respond directly, as i usually can only check news
> once or twice a week
>
> freek
>
> freek@writeme.com
How about something like this?
#!/usr/bin/perl
$imagedir = "your/directory";
$myurl = "http://www.someurl.com/your/directory/";
print "Content-type: text/html\n\n";
opendir(IDIR,"$imagedir") || die "Cannot open $cbdir:$!";
print "<html><body>\n";
foreach $file (sort readdir(IDIR)) {
print "<img src=",$myurl.$file,"><br>\n" if $file =~ /gif/;
print "<img src=",$myurl.$file,"><br>\n" if $file =~ /jpg/;
}
closedir(IDIR);
print "</body></html>\n";
Hope this helps! Tom
...............................................
Tom Resing Programmer/Analyst
GlobalSCAPE www.globalscape.net
...............................................
------------------------------
Date: Tue, 16 Jun 1998 17:09:37 +0200
From: Steve <stijf@hotmail.com>
Subject: Re: perl 5 on NT4 problems
Message-Id: <35868AB1.2B3C@hotmail.com>
2c00l wrote:
>
> I've got perl5 installed on NT4 and am getting the following error when I
> call any cgi script- "%1 is not a valid Windows NT application."
Hi!
I also have the same problem!
I've installed Win95 on a 386 machine to make my scripts work. It's not
very fast offcourse.
So if anyone knowns please help us out!!!!!
------------------------------
Date: 16 Jun 1998 12:06:15 GMT
From: scott@softbase.com
Subject: Re: perl cgi generated html with java app "class not found"
Message-Id: <6m5n3n$ud2$3@mainsrv.main.nc.us>
David Innes (news@ravenstar.com) wrote:
> Could use some help on this one, relatively new to perl.
> I have a perl script which reads an existing html document and creates
> another one from it, with minor changes. The newly created html document
> can not find the Lake.class (which the java needs) while running in the
> perl script. The new html doc runs fine on it's own with the Lake.class
> in the same directory.
> Any suggestions would be appreciated.
For the twenty billionth time: WHEN YOU RUN A CGI PROGRAM, THE DEFAULT
URL IS RELATIVE TO THE CGI DIRECTORY!!! Usually that's
http://what.ever.com/cgi-bin. Your class file is most likely not in
that directory, but you are most likely not prefixing it with the full
URL, you're just saying "foobar.class". Use the full http:// URL to the
class file, or change the default URL in the <head> section.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: Tue, 16 Jun 1998 15:47:56 GMT
From: 6xtippet@CyberJunkie.com
Subject: Re: prob with *.txt file
Message-Id: <35869488.955578709@news.usaor.net>
On Tue, 16 Jun 1998 11:39:01 +0200, "Marc Bornes"
<bornes.marc@pophost.eunet.be> wrote:
>I NEED YOUR HELP,
>
>WHEN A FILE IN FORMAT *.TXT IS DISPLAYED ON THE SCREEN HOW CAN I FREEZE THE
>TWO FIRST LINES AS HEADINGS.
>
>THANK YOU FOR YOUR HELP
>
>HERE IS THE SOURCE CODE :
Please, don't shout at me.
I will give you what I think you want. If this is not what you want
then do your self a favor and learn to program or hire someone who
has.
>&header;
>print <<"HTML";
><H1> Research on "$contents{'keyword'}": </H1>
><HR><P>
><TABLE>
>HTML
>$count=0;
my $line1 = <BOOK>;
my $line2 = <BOOK>;
print "$line1\n$line2\n";
>@sorted = sort(<BOOK>);
>foreach $pair (@sorted)
>{
>
> if ($pair =~ /$contents{'keyword'}/gi)
>
>
> $count++;
> @entry = split(/,/, $pair);
> print
>"<TR><TD><b>$entry[0]</b></TD><TD>$entry[1]</a></TD><TD>$entry[2]</a></TD><T
>D>$entry[3]</b></TD><TD>$entry[4]</b></TD><TD>$entry[5]</b></TD><TD>$entry[6
>]</b></TD><TD>$entry[7]</b></TD><TD>$entry[8]</b></TD><TD>$entry[9]</b></TD>
><TD>$entry[10]</b></TD><TD>$entry[11]</b></TD><TD>$entry[12]</b></TD><TD>$en
>try[13]</b></TD><TD>$entry[14]</b></TD><TD>$entry[15]</b></TD><TD>$entry[16]
></b></TD><TD>$entry[17]</b></TD><TD>$entry[18]</b></TD><TD>$entry[19]</b></T
>D></TP>";
> }
>
>}
>if ($count==0)
> {
> print "Nothing with your reference";
> }
>close(BOOK);
------------------------------
Date: Tue, 16 Jun 1998 11:19:48 -0400
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Problem with MOMSpider
Message-Id: <joe.mcmahon-1606981119480001@prtims.stx.com>
In article <35863E6A.F8F3FC89@dux.dundee.ac.uk>, James Sutherland
<jasuther@dux.dundee.ac.uk> wrote:
>OK, so I can:
>1. Install Perl4
>2. Convert MOMSpider to Perl5
>3. Ditch MOMSpider and write my own link-checker.
>
>1. I can't really install Perl4 again on the WWW server.
>2. Hmm. Big undertaking, but then that's what I thought when I fixed
>WebCopy to handle redirects.
>3. Write my own checker? No thanks. That would be a BIG job and a half..
Number 3 might not be as bad as you think. Check out
http://www.stonehenge.com/merlyn/WebTechniques/col27.html (the column) and
http://www.stonehenge.com/merlyn/WebTechniques/col27.listing.txt (the
source code).
I've used an older version of this before, and found it to work just fine.
I don't think the reporting is as detailed as MOMSpider's, but it may suit
you just fine.
(Thanks, Randal!)
--- Joe M.
------------------------------
Date: Tue, 16 Jun 1998 10:16:33 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Read a filename from a file and open it
Message-Id: <35867E41.22ABD0DF@matrox.com>
Yasir Khalifa wrote:
> The Perl code below, reads the contents of the file HTMLFILE
> and assigns it to a variable $htmldatafile. Now, I want Perl/CGI
> to display the file $htmldatafile but it complains. No file is
> displayed. Any help is appreciated.
> -------------------
> #!/usr/local/bin/perl
>
> require "read_tools.pl";
>
> print "Location: $htmldatafile"," \n\n";
>
> $tmpfile="HTMLFILE"; #this file includes a filename called username.html
>
> if (open(HTFILE, "<".$tmpfile)){
> select(HTFILE);
> $htmldatafile = <HTFILE>; #read the the contents of HTFILE
> close(HTFILE); #and assign it to $htmldatafile,
> #which is now username.html
> }else {
> print "Cannot read from file: $tmpfile","\n";
> }
Well ... you don't show us how you attempted to read that file, but I
suspect you said something like:
open FILE, "<$htmldatafile" or die "Can't open $htmldatafile: $!\n";
That should work, but you'll have to chop off the extra "\n" character that
is appended to $htmldatafile when you read it.
just say :
chomp($htmldatafile);
before you attemp to open the file. If that is not your problem, then try
to post some more code (where you actually attempt to read from the file),
along with the error messages you got.
Hope this helps
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Tue, 16 Jun 1998 15:39:49 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Running commands
Message-Id: <Pine.GSO.3.96.980616083539.7978D-100000@user2.teleport.com>
On Tue, 16 Jun 1998, Azman Shariff wrote:
> ---------------CODE---------------------
> $domain = "microsoft.com"
> $user = "billgates"
>
> #Create User Directories
> ($shortdomain , $extension) = split( /./, $domain );
> @shellresult = `mkdir /virtual/$domain/home/$user`;
> @shellresult = `chmod 711 /virtual/$domain/home/$user`;
> -------SNIP SNIP----------------------------------------
>
> what is wrong there? ......
You left semicolons off of some statements, and you seem to have some
algorithmic errors as well.
> can i run a command thru perl codes? ....
I don't know whether you can. I can. :-)
> i think the double "`" would do the job rite?
I'm not sure what the job rite is, :-) but backticks are documented to be
a way to run an external command and capture its standard output. Of
course, perl has functions to create directories and set permission bits,
so it's not necessary to run external programs if that's all you're doing.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 16 Jun 1998 08:54:49 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: Christopher Soeffing <dolph6@jersey.net>
Subject: Re: Sending mail, can I set the $from ?
Message-Id: <35867929.5E440ECD@houston.Geco-Prakla.slb.com>
[cc to cited author, as requested]
Christopher Soeffing wrote:
>
> I am using the following call . . .
>
> open (MAIL, "|/bin/mail -s '$subject' $towho 2> /dev/null > /dev/null");
>
> which I don't really understand all that much, and the email I get says it
> is from a name that is associated with where I sent the email from. I was
> wondering if I can set the actual "from field" of the message that gets
> sent.
That entirely depends on the /bin/mail program you are using.
> Also if anyone could explain the options that are available when I open a
> file for mail, I would really appreciate it. I assume -s is for setting
> the subject, but what else is there ?
Very good question. A very good answer should be available by doing:
man mail
from a unix prompt. It will give you all kinds of good information
regarding the particular implementation of mail that you are using.
Although 'mail' does similar work on almost all unix platforms, its
particular implementation and options can be vastly different.
If you wish to do things only using perl thingies, you should have a
look at Net::SMTP module which allows you to interact directly with your
SMTP (Simple Mail Transport Protocol) server. That module can be found
on CPAN (Comprehensive Perl Archive Network) at http://www.perl.com/CPAN
HTH.
>
> Thanks. I would really appreciate replies via email to dolph6@jersey.net
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: Tue, 16 Jun 1998 16:15:01 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Simple pattern matching problem
Message-Id: <35868BF4.3033DAD6@nortel.co.uk>
Tom Grydeland wrote:
> Attaboy. <-???? Waddassat mean?
me: You might try html::parser from CPAN.
you: For full HTML parsing, you need a full HTML::Parser.
:-| ?
------------------------------
Date: Tue, 16 Jun 1998 14:47:00 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: strange error message .. "value of <handle> ..."
Message-Id: <8cbtrtjteu.fsf@gadget.cscaper.com>
>>>>> "Allan" == Allan M Due <due@murray.fordham.edu> writes:
Allan> Not so strange. You using a file handle which you defined as
Allan> TMP which may not produce the desired results, so Perl is
Allan> warning you. One solution might be to use
Allan> while ($tmp = defined <TMP>)
Allan> in place of
Allan> while ($tmp = <TMP>)
Allan> to make sure that <TMP> is defined before you get into trouble.
No, no. You've just read TMP and then thrown it away. Definitely
not useful there. You want:
while (defined ($tmp = <TMP>)) { ... record in $tmp ... }
But if you're willing to use $_ instead of $tmp, you can shorten that
to:
while (<TMP>) { ... record in $_ ... }
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 77 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
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: 16 Jun 1998 10:12:01 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Use of DBD::Oracle from cron
Message-Id: <6m5ufh$r0q$1@tholian.cse.psu.edu>
You will be able to duplicate the error by removing your .cshrc or .profile
file and executing another shell. I suspect you're missing ORACLE_HOME, but
if you need to set LD_LIBRARY_PATH your installation may be really foobared.
John
groenveld@acm.org
------------------------------
Date: 16 Jun 1998 10:06:52 GMT
From: "Pete Sattler" <psattler@bestweb.net>
Subject: Re: Windows95, Perl-32 and Personal Web Server (PWS)
Message-Id: <01bd9935$c9543f60$52695ed1@voyager>
> I am trying to set-up an environment on Windows 95 for developing web
> applications. I have installed ActiveState's Perl for Win32 (build 316)
> along with Microsoft's personal web server (PWS). I'm finding that
anytime
> I try to make a call using system() or backticks PWS hangs. I've found
> some recent postings in this newsgroup that discussed the lack of
> intelligence in the standard Windows command shell (command.com). I
> installed the more intelligent 4DOS shell from JP Software, but I have
been
> unable to correct the problem.
>
See http://support.microsoft.com/support/kb/articles/q156/7/55.asp for
Microsoft's "official" resolution, which didn't seem to work for Win95.
> Has anyone else been able to successfully implement this environment?
Any
> help is greatly appreciated!
>
> Pete Sattler
> Chase Manhattan Bank
>
------------------------------
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 2883
**************************************