[6440] in Perl-Users-Digest
Perl-Users Digest, Issue: 65 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 6 17:17:13 1997
Date: Thu, 6 Mar 97 13:00:23 -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 Thu, 6 Mar 1997 Volume: 8 Number: 65
Today's topics:
"Mod of read-only" on an open file <larry@lccinc.com>
[h2ph] Can't convert .h files (Ee Ming)
Re: Basic $ENV questions (Eddie Babin)
Re: Basic $ENV questions (Nathan V. Patwardhan)
Re: Can't run Perl from Win95 DOS command prompt? (Markus Laker)
CGI: File upload binaries? <iswojtow@sfu.ca>
Re: Creating NonExisting File with Perl (Greg Ward)
Re: delete some lines in a doc <wkuhn@uconect.net>
File input through the web (Ronnie Diaz)
Re: Forms AHHHH...Help !!! <david@bradda.demon.co.uk>
Getting Started with Sockets <mstearns@darkwing.uoregon.edu>
Re: Good Perl Book (Bob Stewart)
HELP - Removing Carriage Returns (Allan)
help needed. Win 3.1 perl 5.003_5 setup - newbie <clive@bigfish.co.uk>
Help with -T filetype in Linux a.maclennan@rgu.ac.uk
Re: Interface to BibTeX (Greg Ward)
keys() on a map() fails. Why? (Nik Clayton)
Re: main differences between Awk and Perl (Greg Ward)
Re: Perl & Win 95 <dmills@riag.com>
Re: Perl & Win 95 <dmills@riag.com>
Re: Perl & Win 95 ()
Perl 5 and GDBM (Bill Phu)
Re: perl program works on command line, but not when ru <jcoffin@cs.pdx.edu>
Re: PLEASE HELP! I don't wanna get fired tomorrow!! My (John Quarto-vonTivadar)
Re: Print to Multiple Filehandles <groves@goodnet.com>
Re: Print to Multiple Filehandles <eryq@enteract.com>
Re: Print to Multiple Filehandles <sadd@msc.cornell.edu>
Removing Carriage returns from a multi-line string (Allan)
Re: unix perl <--> Oracle NT / Boston area perl consult <dduncan@realogic.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 06 Mar 1997 11:42:03 -0500
From: Larry Prall <larry@lccinc.com>
Subject: "Mod of read-only" on an open file
Message-Id: <331EF3DB.3D96@lccinc.com>
I ran into something yesterday which struck me as unusual. I got a
"Modification of a read-only value attempted ..." error when I tried
to read from an open file handle. I got the same results when using
FileHandle methods. This happened when I was using a foreach loop
to pass a series of filenames to a subroutine which opened and processed
each file in turn. If I used an explicit loop variable, everything
worked just fine, but when I omitted the loop variable and passed "$_",
it broke. The file name inside the subroutine was the same in both
cases, and in both cases the open on the filename succeeded. Only when
I tried to read from the open file handle was there a problem.
Clearly this is not a big deal, since there is no problem when using
an explicit loop variable, but I don't understand what's happening in
the subroutine. The filename is being constructed from the argument
passed in, and appears to be the same in both cases. The open succeeds.
So what am I missing?
###################################
# This works #
###################################
#!/usr/bin/perl -w
use strict;
my $file;
foreach $file ( 'group', 'passwd', 'hosts' ) {
work( $file );
}
sub work {
my $filename = '/etc/' . shift;
print qq(file is "$filename"\n);
open INPUT, $filename or die "Couldn't open $filename, ";
while (<INPUT>) {
print;
}
}
###################################
# And this doesn't #
###################################
#!/usr/bin/perl -w
use strict;
foreach ( 'group', 'passwd', 'hosts' ) {
work( $_ );
}
sub work {
my $filename = '/etc/' . shift;
print qq(file is "$filename"\n);
open INPUT, $filename or die "Couldn't open $filename, ";
while (<INPUT>) {
print;
}
}
--
+----------------------------------------------------------------------+
| Larry Prall LCC International (703)351-6380 |
| Release Engineering 2300 Clarendon Blvd, Ste 800 Fax:(703)525-7241 |
| Dept 34, Rm 938, Arlington, VA 22201 larry@lccinc.com |
+----------------------------------------------------------------------+
------------------------------
Date: 6 Mar 1997 17:17:48 GMT
From: toheemin@iscs.nus.sg (Ee Ming)
Subject: [h2ph] Can't convert .h files
Message-Id: <5fmu7s$jmd@nuscc.nus.sg>
I tried running h2ph script to convert C's .h files into perl's .ph files
but I got a message that says that the files cannot be open, although the
file exists. Anybody know what's wrong??
TIA!
Ee Ming
--
Mountains fall and seas divide before the one
who in his stride takes a hard road day by day,
sweeping obstacles away.
------------------------------
Date: 6 Mar 1997 18:03:05 GMT
From: ebabin@cyberenet.net (Eddie Babin)
Subject: Re: Basic $ENV questions
Message-Id: <5fn0sp$peb@news.cyberenet.net>
Nathan V. Patwardhan (nvp@shore.net) wrote:
: Eddie Babin (ebabin@cyberenet.net) wrote:
:
: : I don't know why I can't get all ( or any) of the enviroment
: : settings written to a file. The only fields written are the
: : date and the REMOTE_ADDR. I've accessed the page through
: : several different servers with the same result. Any help
: : would be appreciated.
:
: Is this what you were looking for?
:
: $envfile = '/path/myenv.txt'; ### make sure file and directory have
: ### the correct permissions
:
: open(OUTFILE, ">>$envfile") || print("File error: $!"); ### open a/c
: foreach $key (sort keys %ENV) {
: print OUTFILE $ENV{$key},"\n";
: }
: close(OUTFILE);
:
: --
: Nathan V. Patwardhan
: nvp@shore.net
: "What is your quest?"
Thanks for your help. This gave some of the environment variables.
How can I access the rest?
ed
--
------------------------------
Date: 6 Mar 1997 18:44:41 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Basic $ENV questions
Message-Id: <5fn3ap$dfu@fridge-nf0.shore.net>
Eddie Babin (ebabin@cyberenet.net) wrote:
: Thanks for your help. This gave some of the environment variables.
: How can I access the rest?
That *was* all the environment variables. Which others were you
looking for?
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Thu, 06 Mar 1997 20:13:51 GMT
From: mlaker@contax.co.uk (Markus Laker)
Subject: Re: Can't run Perl from Win95 DOS command prompt?
Message-Id: <5fn8m2$2s2$1@newsserver.dircon.co.uk>
__felbel@csn.net__ (Fred Elbel) wrote:
> When I try to run from a DOS command prompt line (a DOS window), the
> response is "This program can not be run in DOS mode.". According to
> several posts, and section 1.14 of Evangelo Prodromou's FAQ, Perl
> should run OK from the command line.
Running 'in DOS mode' means restarting the machine in MS-DOS mode
(Ctrl+Esc, U, M). That isn't the same as running inside a DOS prompt
(which you can find on the Programs menu).
You can run several DOS prompts and Windows programs at the same time,
but you get the whole overhead of Windows and all its drivers. In
MS-DOS mode, on the other hand, all you get is the DOS prompt: there's
no graphical user interface and many of the normal drivers don't load.
You can only run DOS programs, and then only one at once. MS-DOS mode
is normally used only for debugging an unstable system or for running
DOS programs that don't run well in Windows.
It's possible that your DOS prompt is configured to go into MS-DOS
mode automatically. That would prevent Perl from running. To find
out, open a DOS prompt alongside one or more other apps, then use
Alt+Tab to switch tasks. If nothing happens, you're in MS-DOS mode.
To correct that, exit, then right-click your Start menu, navigate to
your DOS prompt shortcut, right-click it, select Properties, click
Advanced, and then click 'suggest MS-DOS mode as necessary'.
What did it say when I installed Win95 on my system? Ah, yes:
'everything you do will be easier and more fun'. Yeah. Right.
Hope things work out for you.
Markus Laker
------------------------------
Date: Thu, 6 Mar 1997 07:43:08 -0800
From: Ian Stanislaw Wojtowicz <iswojtow@sfu.ca>
Subject: CGI: File upload binaries?
Message-Id: <Pine.SGI.3.95.970306074024.23325D-100000@fraser>
Hi,
I'm currently using an implementation of fup.pl to handle file uploads
through netscape to my web server, however it only seems to enjoy
transferring ASCII files (binary files get corrupted). What can I do? Is
there a FAQ on this topic?
Thanks,
ian wojtowicz
ps: please reply to ian@knowarch.com
pps: I'm running NT 4.0
------------------------------
Date: 6 Mar 1997 18:21:29 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: Re: Creating NonExisting File with Perl
Message-Id: <5fn1v9$4hl@sifon.cc.mcgill.ca>
: in unix you can do a 'touch filename' to create a new file.
: so for example you want to create a unique file you would do
: perl -e '`touch abcd.$$`'
: hope that helps.
Blechh! What an ugly solution. This will indeed create a new, empty
file, but has a number of disadvantages:
* imposes overhead of calling another program
* unnecessary use of the `` operator (if you don't know what exactly
they do, then GO READ THE FINE MANUAL before posting wildly)
* doesn't check for errors
* doesn't give a filehandle that the programmer can then write to
This is overall such a boneheadedly obvious and simple question that I'm
not going to stoop to answering it; I just thought such a misleading
answer needed to be countered.
Greg
--
Greg Ward - Research Assistant greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201) voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute fax: (514) 398-8948
Montreal, Quebec, Canada H3A 2B4
------------------------------
Date: Thu, 06 Mar 1997 13:07:30 -0500
From: Bill Kuhn <wkuhn@uconect.net>
To: LMD/T/KR <lmdtlb@lmd.ericsson.se>
Subject: Re: delete some lines in a doc
Message-Id: <331F07E2.5326F2F7@uconect.net>
LMD/T/KR wrote:
>
> HI
>
> To all the PERL experts, I am new in the PERL lang. But I have to
> make a little script to remove some lines in a document. I have reach
> the point where I can open the file and and print the lines I would like
> to delete.
> 1. have do I delete the line(s) ?
> The lines looks like this : .* { 1.1.1 }
> .* { 1.1.2 }
> .* { 1.2 }
> .* { 1.2.1 }
> .* { 2 }
>
> 2. have do make/save the new file ? ( could it be the same file ? )
>
> Thanks
>
> Regards Thomas Albrink
>
> e-Mail: lmdtlb@lmd.ericsson.se
I would suggest making a backup until you are absolutely sure that you
are removing the right lines.
Do you have any perl reference material? Read about the command line
switches (man perlrun).
I would do something like this:
(line wrapped)
perl -i.bak -e 'while (<>) {print if !/expr1/ && !/expr2/ && etc, etc}'
filename
The above will (once you fill in the proper regular expression syntax)
remove lines which match the regular expressions and write to the
filename. A backup of filename, filename.bak, will be created in the
event that your expressions don't work.
Hope this helps.
-Bill
--
Bill Kuhn
Chief Developer
Wired Markets, Inc.
http://www.buyersindex.com
------------------------------
Date: 6 Mar 1997 10:43:48 -0800
From: rad91@best.com (Ronnie Diaz)
Subject: File input through the web
Message-Id: <5fn394$d9r@shellx.best.com>
Is it possible to to write files in perl scripts called by a web page?
I have the following, and its not working (though it works fine on the
shell).
#!/usr/local/bin/perl
require 'cgi-lib.pl';
&ReadParse(*in);
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Well?</TITLE></HEAD><BODY>";
print "It reached this far. HMMM<BR></BODY></HTML>\n";
open (STDOUT, ">submitted_file");
print STDOUT "<HTML><HEAD><TITLE>\n";
print STDOUT " Submitted Article Awaiting Approval \n";
print STDOUT "</TITLE></HEAD><BODY BGCOLOR=WHITE> \n";
print STDOUT "<FONT SIZE=+2>\n";
print STDOUT " $in{'dept'} Article Awaiting Approval\n";
print STDOUT "</FONT><BR><BR>\n";
print STDOUT "This article is by email user: $in{'email'}<BR><BR>\n";
print STDOUT "$in{'article'}<BR><BR>\n";
close (STDOUT);
STDOUT will get printed in HTML, but not on a file 'submitted_file'.
Am I going about this wrong?
-ronnie
rad@appsig.com
------------------------------
Date: Wed, 5 Mar 1997 15:21:46 +0000
From: David Darwent <david@bradda.demon.co.uk>
Subject: Re: Forms AHHHH...Help !!!
Message-Id: <4Fmq6BAK+YHzIwSk@bradda.demon.co.uk>
In article <857530365.18437@dejanews.com>, nickp@futuris.net writes
>In article <3315518f.1678832@news.demon.co.uk>,
> mark@channelzero.demon.co.uk wrote:
>>
>> This is rather sad, i need desperate help with creating html forms. I
>> can create the front end (ie. the actual bit where the user types in
>> the info.) but i can't get it to process and e-mail the info to the
>> address that i give it.
>
>This is actually very simple. just specify the method and post attributes
>at the begining in the form tag itself, like this:
>
><Form action="mailto:me@myplace.net" method=post Enctype=text/plain>
The only problem with this is that the only browser that currently
supports the mailto tag within forms is Netscape Nav. So this method is
best avoided, until more browsers support it.
>The enctype attribute just will make sure the returned information is
>written in plain text, and not raw ASCII.
>
>It's all explained in detail in my forms tutorial at:
>http://www.futuris.net/nickp/tags/forms/
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
All the best,
David Darwent
------------------------------
Date: Thu, 06 Mar 1997 13:23:31 -0800
From: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: Getting Started with Sockets
Message-Id: <331F35D3.4CFA46D2@darkwing.uoregon.edu>
I am trying to understand sockets and I am having an immediate problem:
When I do something like this:
#!/usr/local/bin/perl
require 5.002;
use socket;
$text="Foo\n";
print " - $text/n";
I get:
Can't locate socket.pm in @INC at script2 line 3.
Could someone explain how I need to set up the socket stuff on my system
so the script can see it?
Also, I am following an example on p.265 of ORA's "CGI Programming" and
I am having a similar problem. Is this script out of date for Perl 5? Is
there a good discussion somewhere of using modules (I am assuming that
"socket" is some kind of external module)?
THanks,
Michael Stearns
University of Oregon
P.S. Is there a separate newsgroup for Perl CGIs?
------------------------------
Date: Thu, 06 Mar 1997 18:01:32 GMT
From: rstewart@mars.superlink.net (Bob Stewart)
Subject: Re: Good Perl Book
Message-Id: <331f064d.15496215@news.digex.net>
On 5 Mar 1997 16:56:17 GMT, "Ray Cadmus" <rcadmus@mcmsys.com> wrote:
>Learning Perl by Randal Schwartz (O'Reilly)
>
We have this for 25% off list at:
http://www.readmedotdoc.com
Learning Perl
by Schwartz, Randal L.
ISBN: 1565920422
Pub: O'REILLY & ASSOC., 1993, 246 pp.
$24.95 Our Price: $18.71
Perl is language for easily manipulating test, files and
processes. It is available for UNIX and other operating
systems free of charge,Contents of this book cover: A quick
tutorial stroll through Perl inone lesson - Systematic,
topic-by-topic coverage of Perl's broad capabilities - how to
access nearly any UNIX system through Perl -
how to use Perl with databases and much, much more
We have 3,500 other books, all 20-35% off.
http://www.readmedotdoc.com
------------------------------
Date: Thu, 06 Mar 1997 19:08:50 GMT
From: asp@enterprise.net (Allan)
Subject: HELP - Removing Carriage Returns
Message-Id: <331e0ab2.579585@news.enterprise.net>
Howdy,
I would be grateful if anyone could help me with this problem?
I am receiving som data from an HTML form <textarea>. When the
contents of the form <textarea> are submitted the data is extracted no
problem, but I want to be able to remove any carriage returns from the
text and concatenate the info to make just one long line.
i.e. data in $ques is
What time<return>
<return>
<return>
is<return>
it?<return>
and after removal of carriage returns <return> I want the variable
contents to end up with:
What time is it?
I'm sure its nothing too complicated, but I am pretty new to perl and
programming in general, so any help would be greatly appreciated.
I am running perl 5.00x
Thanks in advance
Allan
------------------------------
Date: Thu, 06 Mar 1997 18:40:45 +0000
From: Clive Holloway <clive@bigfish.co.uk>
Subject: help needed. Win 3.1 perl 5.003_5 setup - newbie
Message-Id: <331F0FAC.2CF9@bigfish.co.uk>
Hi,
I'm very new to Perl (about a week). I'm trying to set up cgi.pm and
other modules and am failing drastically. I'm not an expert on
configuring my machine, but thought I'd set up the stuff OK and added
the correct environment variables.
But, when I try to run a script that requires cgi.pm, Perl can't find
it.
Can anyone spare me the time to talk me through where I'm going wrong?
I've downloaded several zip files, but the documentation enclosed isn't
thorough enough for me!!!
What I have:
cgipm.zip
emxrt.zip
perl_aou.zip
perl_mlb.zip
perl_ste.zip
rsx510b.zip
sh_dos.zip
Are they all I need? Am I doing something drastically wrong? Is there
anybody out there who can help????
Clive ;-)
--
big fish web design Tel: +44 (0)15395 64580 pager: 0336 778419
21-23 Park Road Fax: +44 (0)15395 63487
Milnthorpe To do is to be
Cumbria To be is to do
LA7 7AD UK Do be do be do
------------------------------
Date: Thu, 06 Mar 1997 11:27:27 -0600
From: a.maclennan@rgu.ac.uk
Subject: Help with -T filetype in Linux
Message-Id: <857667701.26610@dejanews.com>
I'm trying out example listings in the Camel and Llama books, and can't
seem to get the -T filetype to select text files in Linux - is this
Unix-only? Also, does the UID stuff for passwords work in Linux (it's
used in the first Llama progs)?
Sorry for the newbie queries - any assistance much appreciated.
Alan.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 6 Mar 1997 18:09:35 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: Re: Interface to BibTeX
Message-Id: <5fn18v$4hl@sifon.cc.mcgill.ca>
Guido Kanschat (kanschat@iwr.uni-heidelberg.de) wrote:
: Has anybody written an interface to read
: BibTeX files into Perl?
: I would be very interested in getting such a code.
Yep -- I'm just putting the finishing touches on an object-oriented
interface to an underlying C library that parses BibTeX. It's in a good
enough state for an alpha release, but there're still some memory leaks
(they get pretty significant when processing many MBs of .bib data).
What I have now will be sufficient for trying it out and working with
smallish (< 1 MB I'd say) amounts of data.
Thanks for the prod; I'll try to get it together tonight. Look for an
announcement on c.l.p.announce.
Greg
--
Greg Ward - Research Assistant greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201) voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute fax: (514) 398-8948
Montreal, Quebec, Canada H3A 2B4
------------------------------
Date: 6 Mar 1997 19:55:06 GMT
From: nik@coconut.blueberry.co.uk (Nik Clayton)
Subject: keys() on a map() fails. Why?
Message-Id: <5fn7eq$mre@roadrunner.atlas.co.uk>
How do,
I'm trying to use the map() func to build an assoc. array, and then use the
keys() function to get the keys from this array.
This works fine if I use a temporary variable to hold the hash, but not
if I try and use keys() directly on the output of map().
Why?
This is with
This is perl, version 5.003 with EMBED
built under freebsd at Nov 13 1996 17:22:42
+ suidperl security patch
This code fragment works
#!/usr/local/bin/perl
%foo = map { $_ => 1 } ( 1, 2, 3); # Build assoc. array
print join(':', keys %foo);
And prints '1:2:3' as expected.
This one
#!/usr/local/bin/perl
print join(':', keys map { $_ => 1 } ( 1, 2, 3 ) );
fails. The error message is
Type of arg 1 to keys must be hash (not map iterator)
As I say, why?
FWIW, I'm trying to shrink down the following one liner,
/usr/local/bin/perl -e \
'chomp($_=<>);%_=map{$_=>1}split(/:/);print join(":",keys %_);'
(which, for those that are interested, takes a ':' delimited string, say,
$PATH, and returns the same string with duplicate elements removed).
Cheers for any enlightenment.
N
--
--+=[ Blueberry Hill Blueberry New Media ]=+--
--+=[ http://www.blueberry.co.uk/ 1/9 Chelsea Harbour Design Centre, ]=+--
--+=[ WebMaster@blueberry.co.uk London, England, SW10 0XE ]=+--
--+=[ non ex transverso sed deorsum ]ENTP
------------------------------
Date: 6 Mar 1997 18:39:11 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: Re: main differences between Awk and Perl
Message-Id: <5fn30f$4hl@sifon.cc.mcgill.ca>
Candice Chauve (chauve@info.univ-angers.fr) wrote:
: What are the principal reasons for using Perl or Awk?
: What are the main functions of Perl in comparaison with the functions of
: Awk?
: What can decide us using Perl more than Awk?
: We are french students and we only use Awk ,because we don't know the
: Perl language!So we are waiting from you to decide us to learn Perl!
All your questions, and many more that you didn't even know you had, are
answered in the Perl FAQ:
http://www.perl.com/faq
--
Greg Ward - Research Assistant greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201) voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute fax: (514) 398-8948
Montreal, Quebec, Canada H3A 2B4
------------------------------
Date: Thu, 06 Mar 1997 13:55:12 -0500
From: Daniel Mills <dmills@riag.com>
Subject: Re: Perl & Win 95
Message-Id: <331F1310.7E3C@riag.com>
Have you tried the on from ActiveWare (i.e. www.ActiveWare.com)? It
looks like it was a MicroSoft sponsored port (for whatever that's worth).
I'm currently trying to get it up and running on a NT server machine but
the install BAT is puking.
-- Dan
=========================================================
Dan Mills
RIAG
dmills@riag.com
---------------------------------------------------------
The opinions expressed here are those of the author only.
Sorry to be so uncreative here but I'm just too busy (or
slow) to do anything about it.
=========================================================
------------------------------
Date: Thu, 06 Mar 1997 13:54:05 -0500
From: Daniel Mills <dmills@riag.com>
To: kmiller@mail.cheta.net
Subject: Re: Perl & Win 95
Message-Id: <331F12CD.11FC@riag.com>
Kevin A. Miller wrote:
>
> Someone please help; I am looking for Perl5 that will run on my P-166
> system using Win95. I have tried to use Perl for Win32 from various
> sources (CD's from books), but it does not install fully or well enough
> to run. Does anybody have any ideas or means to get the info to run it
> on my OS. Thank you,
> K. Miller kmiller@cheta.net
Have you tried the on from ActiveWare (i.e. www.ActiveWare.com)? It
looks like it was a MicroSoft sponsored port (for whatever that's worth).
I'm currently trying to get it up and running on a NT server machine but
the install BAT is puking.
--Dan
=========================================================
Dan Mills
RIAG
dmills@riag.com
---------------------------------------------------------
The opinions expressed here are those of the author only.
Sorry to be so uncreative here but I'm just too busy (or
slow) to do anything about it.
=========================================================
------------------------------
Date: 6 Mar 1997 19:23:43 GMT
From: scott@lighthouse.softbase.com ()
Subject: Re: Perl & Win 95
Message-Id: <5fn5jv$l53@mainsrv.main.nc.us>
Jeff Wilson (jwilson@ic.ac.uk) wrote:
: I downloaded Perl (Win32) from Activeware, http://www.perl.hip.com/,
: to my Windows95 P100 and it installed without any real problems.
It's the imaginary problems that get you.
Scott
------------------------------
Date: 6 Mar 1997 20:22:38 GMT
From: pcb@is.dal.ca (Bill Phu)
Subject: Perl 5 and GDBM
Message-Id: <5fn92e$ku0@News.Dal.Ca>
Hi there,
I am trying to get a pseudo-database setup using Perl. I read the
manpages and they all point me to tie(), but the man pages for tie are
almost useless to a perl neophyte. I have a C brackground and was just
wondering how I would get C 'structures' implemented in Perl and how I
would be able to do this in Perl using tie(), etc. I know our system
already has gdbm on it and thought I'd go on from there. The program is
going to be a small addressbook application for a small intranet.
Thanks,
Bill
--
Bill Phu -- Geology & Engineering (pcb@is2.dal.ca)
"Don't walk in front of me, I will not follow.
Don't walk behind me, I will not lead.
Walk beside me, and be my friend." - Source Unknown
------------------------------
Date: 06 Mar 1997 11:06:53 -0800
From: Jeff Coffin <jcoffin@cs.pdx.edu>
Subject: Re: perl program works on command line, but not when run through www server
Message-Id: <m2ohcwq1pu.fsf@cs.pdx.edu>
>>>>> "Chris" == Chris Engel <cengel@nh1adm.uwaterloo.ca> writes:
Chris> However, when I try and run the program using lynx or netscape,
Chris> the program doesn't save anything that was printed from the
Chris> print statements. It will print everything else.
This tells us that you are having a rather common _cgi_ problem, not a
Perl probelm, since your code works, from the command line. There is
a whole other newsgroup devoted to dealing with these problems called
comp.infosystems.www.authoring.cgi. Try posting there for these sorts
of problems. They have an excellent FAQ that will help you solve your
cgi problem in a flash. There is also an idiots guide to solvin cgi
problems at:
http://www.perl.com/perl/faq/perl-cgi-faq.html
This should set you right.
-jeff
------------------------------
Date: Thu, 06 Mar 1997 18:59:14 GMT
From: trader@ids.net (John Quarto-vonTivadar)
Subject: Re: PLEASE HELP! I don't wanna get fired tomorrow!! My girlfriend leaves me last week now this! Ugh!
Message-Id: <331f13de.49338019@paperboy.ids.net>
try:
www.jobfind.com
------------------------------
Date: Thu, 06 Mar 1997 10:51:59 -0800
From: Jeff Groves <groves@goodnet.com>
To: Tom Lynch <toml@synnet.com>
Subject: Re: Print to Multiple Filehandles
Message-Id: <331F124F.5124@goodnet.com>
Tom Lynch wrote:
>
> Greetings:
>
> I have a couple of Filehandles open and would like
> to print the same text to each one, only when a
> certain condition is hit. Currently I do
>
> print FILE1 "Todays Date\n";
> print FILE2 "Todays Date\n";
> print FILE3 "Todays Date\n";
>
> Does perl have a way to just put this as one statement?
> Like:
>
> print (FILE1, FILE2, FILE3) " Today's Date\n";
>
> I suppose I could put the files to a list, and do
> a foreach to open, print then close each one here,
> but I thought there might be a better way.
Why not just create a subroutine to do what you want:
sub print3 {
my ($msg) = @_;
print FILE1 "$msg";
print FILE2 "$msg";
print FILE3 "$msg";
}
------------------------------
Date: Thu, 06 Mar 1997 12:45:24 -0600
From: Eryq <eryq@enteract.com>
To: Tom Lynch <toml@synnet.com>
Subject: Re: Print to Multiple Filehandles
Message-Id: <331F10C4.6F6EDF5C@enteract.com>
Tom Lynch wrote:
>
> Greetings:
>
> I have a couple of Filehandles open and would like
> to print the same text to each one, only when a
> certain condition is hit. Currently I do
>
> print FILE1 "Todays Date\n";
> print FILE2 "Todays Date\n";
> print FILE3 "Todays Date\n";
>
> Does perl have a way to just put this as one statement?
> Like:
>
> print (FILE1, FILE2, FILE3) " Today's Date\n";
>
> I suppose I could put the files to a list, and do
> a foreach to open, print then close each one here,
> but I thought there might be a better way.
>
> Thanks for any and all help.
>
> Tom
>
> --
Well, you could probably use a subroutine:
sub mprint {
print FILE1, @_;
print FILE2, @_;
...
}
mprint "This is my message";
Or you could even go object-oriented...
--------------------------------
package MultiHandle;
sub new {
my ($class, @handles) = @_;
$self = {H=>[@handles]};
bless $self, $class;
}
sub print {
my $self = shift;
foreach (@{$self->{H}}) {
print $_ @_;
}
}
---------------------------------
my $H = new MultiHandle \*STDOUT, \*STDERR;
$H->print("Hi!\n");
--
___ _ _ _ _ ___ _ Eryq (eryq@enteract.com)
/ _ \| '_| | | |/ _ ' / Hughes STX, NASA/Goddard Space Flight Cntr.
| __/| | | |_| | |_| | http://www.enteract.com/~eryq
\___||_| \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
|___/ |______/ of the homeless: http://www.streetwise.org
------------------------------
Date: Thu, 06 Mar 1997 14:45:50 -0500
From: Michael Sadd <sadd@msc.cornell.edu>
To: Tom Lynch <toml@synnet.com>
Subject: Re: Print to Multiple Filehandles
Message-Id: <331F1EEE.64308824@msc.cornell.edu>
The following appears to work, althought the -w gives
an odd warning. (Can anyone tell be why? I clearly
reference the file handles twice. Am I doing something
that is bad form?)
#!/usr/bin/perl -w
open(FILE1,">&STDOUT");
open(FILE2,">&STDOUT");
open(FILE3,">&STDOUT");
map {print $_ "Today's Date.\n"}(FILE1,FILE2,FILE3);
__END__
Identifier "main::FILE1" used only once: possible typo at temp.pl line
3.
Identifier "main::FILE2" used only once: possible typo at temp.pl line
4.
Identifier "main::FILE3" used only once: possible typo at temp.pl line
5.
Today's Date.
Today's Date.
Today's Date.
Tom Lynch wrote:
>
> Greetings:
>
> I have a couple of Filehandles open and would like
> to print the same text to each one, only when a
> certain condition is hit. Currently I do
>
> print FILE1 "Todays Date\n";
> print FILE2 "Todays Date\n";
> print FILE3 "Todays Date\n";
>
> Does perl have a way to just put this as one statement?
> Like:
>
> print (FILE1, FILE2, FILE3) " Today's Date\n";
>
> I suppose I could put the files to a list, and do
> a foreach to open, print then close each one here,
> but I thought there might be a better way.
>
> Thanks for any and all help.
>
> Tom
>
> --
--
| Michael Sadd | Cornell Univerisity |
| Department of Physics and | Ithaca, NY 14850 |
| Lab of Atomic and Solid State Physics | www.msc.cornell.edu/~sadd/ |
------------------------------
Date: Thu, 06 Mar 1997 19:11:04 GMT
From: asp@enterprise.net (Allan)
Subject: Removing Carriage returns from a multi-line string
Message-Id: <331f169f.435433@news.enterprise.net>
Howdy,
I would be grateful if anyone could help me with this problem?
I am receiving some data from an HTML form <textarea>. When the
contents of the form <textarea> are submitted the data is extracted no
problem, but I want to be able to remove any carriage returns from the
text and concatenate the info to make just one long line.
i.e. data in $ques is
What time<return>
<return>
<return>
is<return>
it?<return>
and after removal of carriage returns <return> I want the variable
contents to end up with:
What time is it?
I'm sure its nothing too complicated, but I am pretty new to perl and
programming in general, so any help would be greatly appreciated.
I am running perl 5.00x
Thanks in advance
Allan
------------------------------
Date: Thu, 06 Mar 1997 15:09:12 -0500
From: Diana Duncan <dduncan@realogic.com>
Subject: Re: unix perl <--> Oracle NT / Boston area perl consultants?
Message-Id: <331F2468.7BF7@realogic.com>
cdagdigian@genetics.com wrote:
>
> I've written a large number of perl scripts and CGI's (running on DEC
> Alpha's w/ Digital Unix) that are used to analyze or play with cDNA
> sequences.
>
> I now find myself in a position where some of my perl scripts are going to
> have to communicate their results to an Oracle database that will probably
> be sitting on an NT platform.
>
> The more I read about the various Oracle/Perl modules the more I get
> confused... it also seems that most of the solutions are aimed at
> situations where Perl, the scripts and the Oracle database are all
> resident on the same machine.
>
> Any recomendations or pointers to resources that deal with using perl to
> communicate with Oracle *across a network* would be greatly appreciated.
>
> On a similar note, I would welcome contact from any New England area
> consultants who have experience in this area.
>
> regards,
> Chris Dagdigian, cdagdigian@genetics.com
> Genetics Institute
> Cambridge, MA US
>
> --
> Spam me at your own risk.
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
Well, actually this *should* be quite easy. If you use the lovely
Oraperl module, it seems to handle SQL*Net connect strings. So, just set
up a SQL*Net client on your DEC box, and when you login to the database
supply the appropriate database alias. SQL*Net will take care of the
connection.
Now, I have not had an occasion to actually try this, so if it is not
the case, please don't blame me ;-)
--
Diana Duncan | My opinions are my own.
Sr. Consultant |
REALOGIC, Inc. | Excitement, Adventure and
dduncan@realogic.com | Really Wild Things - Z.B.
------------------------------
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 65
************************************