[8386] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2003 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 2 15:15:48 1998

Date: Mon, 2 Mar 98 12:00:35 -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           Mon, 2 Mar 1998     Volume: 8 Number: 2003

Today's topics:
    Re: Conflict in this Newsgroup <Joergen.Lang@schwaben.de>
    Re: Conflict in this Newsgroup (Mike Heins)
    Re: Conflict in this Newsgroup <fearless@nospam.io.com>
    Re: Courthouse and Perl <Joe.Kline@sdrc.com>
    Re: Faxing from Perl scott@softbase.com
        gamma function or chi-square? <msda+@andrew.cmu.edu>
        GDBM for WinNT <shanahjc@ibm.net>
        Help: can't load library error when trying to execute c (Fay-Tjung Liu)
        How to get password-protected documents on Web? <auditbot@us.ibm.com>
    Re: interpolation in subroutine calls (Andrew M. Langmead)
        ksh2perl converter? (Ed Overton)
        Location: and targets help <webmaster@netminder.com>
    Re: Looking for a program called 'Brief' (Brian Sawert)
    Re: Multiple Packages per *.pm <mishra.aditya@emeryworld.com>
    Re: need info on obtaining perl for windows 3.1 <quentin@jihad.amd.com>
    Re: newbie: breaking a line of text into two chunks (Craig Berry)
        Online Perl Guru (Was:Re: Conflict in this Newsgroup) <ajohnson@gpu.srv.ualberta.ca>
    Re: Question for Tom Christiansen <blk@redneck.intel.com>
    Re: Regional PUGs <fearless@nospam.io.com>
        running a long script without waiting?  HELP! exec() di (Scott Cherkofsky)
    Re: running a long script without waiting? HELP! exec() (Jim Allenspach)
    Re: Scalar variable problem! <barnett@houston.Geco-Prakla.slb.com>
        shift doesn't, NEXT-to-last value? (James Dudley)
    Re: shift doesn't, NEXT-to-last value? <jdf@pobox.com>
    Re: SQL sytax in Perl? Do you know.... (John Stanley)
    Re: Strict (Craig Berry)
        Telnet prompt: how type username and password automatic <a-namsuk@microsoft.com>
    Re: Telnet prompt: how type username and password autom (Zachery J. Bir)
    Re: What does this one-liner do? (John Moreno)
    Re: What does this one-liner do? (Steve Linberg)
    Re: What does this one-liner do? (Richard Bellavance)
    Re: Why doesn't "tr/\x0D//d" work? (Mike Stok)
    Re: Why doesn't "tr/\x0D//d" work? (Andrew M. Langmead)
    Re: Why doesn't "tr/\x0D//d" work? (Tom Grydeland)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 02 Mar 1998 18:59:40 +0000
From: Joergen Lang <Joergen.Lang@schwaben.de>
Subject: Re: Conflict in this Newsgroup
Message-Id: <34FB019D.DFC@schwaben.de>

Randal Schwartz wrote:

<snip>

> This is accurate.  I am *continually* *appalled* at the "take and no
> give" attitude prevailing in most Usenet groups these days.
> Especially in comp.lang.perl.*, seeing as that's my "home" for the
> moment.
> 

A newbie perspective (mid - Llama - level):

I have only recently asked my first question in this newsgroup and was
amazed by the amount of support I got. Within only a few hours after I
posted, I had a solution. Having checked FAQ / CPAN before, goes without
question.

The only problem I have is that I do not feel confident enough, yet to
reward this by answering other people's questions. 

So, the few "Gives" I can offer for the moment are to say "Thanks" when
a question is answered and keep following the ongoing issues in this
newsgroup. Eventually I hope to be able to participate more actively and
re - distribute the knowledge I got. 

But then, how could I assure that I don't tell people something wrong or
worse, especially if there are people around who know it much better ?
What I had a working solution for someones problem and post it. What if
the solution was insecure or outdated ?
Hm, I suppose I'd just have to put up with the flames....:-)

I'm not sure what measures apply to be able to switch to "give", I
suppose it's just reading the postings and giving it a try to answer
when I think I can help. Maybe this could take some weight of the
shoulders of the "seniors" who seem to answer 90% of the questions.
I'm aware that Q+A are not the sole function of clpm (Are they at all ?)

Joergen
-- 
____________________________________________________________

"You come from nothing - you go to nothing. So what have you got ?
 ***Nothing*** !"      -     Monthy Python.
_____________________________________________________________


------------------------------

Date: 2 Mar 98 18:20:18 GMT
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Conflict in this Newsgroup
Message-Id: <34faf862.0@news.one.net>

Joergen Lang <Joergen.Lang@schwaben.de> wrote:
> A newbie perspective (mid - Llama - level):
[snip]
> I have only recently asked my first question in this newsgroup and was
> amazed by the amount of support I got. Within only a few hours after I
> posted, I had a solution. Having checked FAQ / CPAN before, goes without
> question.
>
> The only problem I have is that I do not feel confident enough, yet to
> reward this by answering other people's questions. 
>
> So, the few "Gives" I can offer for the moment are to say "Thanks" when
> a question is answered and keep following the ongoing issues in this
> newsgroup. Eventually I hope to be able to participate more actively and
> re - distribute the knowledge I got. 
>
> But then, how could I assure that I don't tell people something wrong or
> worse, especially if there are people around who know it much better ?
> What I had a working solution for someones problem and post it. What if
> the solution was insecure or outdated ?
> Hm, I suppose I'd just have to put up with the flames....:-)
[snip]

We have a saying in contract bridge -- "If you always make your
contract, you aren't bidding enough."

Same goes for answering questions. I went through the stage you
describe about 3 years ago. I answered questions, sometimes got
things wrong, and was (mostly) gently corrected by Randal, Tom,
et al. (What the heck, I got corrected last week by Jochen on
a DBI answer.)

I got to see where I went wrong, learned something, and the 
original question was ultimately answered well. Many people
now consider me to be a pretty proficient Perl programmer, and
much of my growth came from this process.

The danger is that the signal/noise ratio of the group gets so low that
the experts can't reasonably perform their oversight function. Even then,
the process will still sometimes work, as all many people are looking
for is a nudge in the right direction. A bigger problem is that Deja
News will preserve the wrong answer for posterity.

Regards,
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
There ain't nothin' in this world   131 Willow Lane, Floor 2  | ||  _ \
that's worth being a snot over.     Oxford, OH  45056         | || |_) |
--Larry Wall                        <mikeh@minivend.com>     |___|  _ <
                                    513.523.7621 FAX 7501        |_| \_\


------------------------------

Date: Mon, 2 Mar 1998 10:55:04 -0800
From: "Creede Lambard" <fearless@nospam.io.com>
Subject: Re: Conflict in this Newsgroup
Message-Id: <6devde$pi1@news.microsoft.com>

This is a GREAT idea. Just one question: Will this message come up
automatically when you install Perl, before you're returned to the shell
prompt?

I would also think "information on getting further help" or something
similar might be better than "VERY IMPORTANT perl info". Very important perl
info could be anything from a memory utilization readout to an ad for the
Perl Clinic. There are going to be some out there who will need to be beaten
over the head with, er, led by the hand to, the idea that This Is How To Get
Help With Perl.

Just my 50,000 krankheits. (About 2 cents, according to an old Yosemite Sam
cartoon.)

-- Creede

Tom Christiansen <tchrist@mox.perl.com> wrote in message
news:6deg8h$mgj$1@csnews.cs.colorado.edu...
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, bart.mediamind@tornado.be (Bart Lateur) writes:
>:I just had a silly idea: let the Perl executable display an intro text
>:pointing towards the documentation,
>
>Fixed in the next release.  I'm quite serious -- I did this last week
>or so.




------------------------------

Date: Mon, 02 Mar 1998 14:14:41 -0500
From: Joe Kline <Joe.Kline@sdrc.com>
Subject: Re: Courthouse and Perl
Message-Id: <34FB0521.BB8F5CE5@sdrc.com>

Does anyone else find this the least ironic considering
Randal's current state of affairs with the judicial
system?

joe

Butch Bridges wrote:
> 
> I am trying to decide if Perl is the way to go with placing our court
> records on the Net so the public can access them.  Is it very
<SNIP>

--

Joe Kline


------------------------------

Date: 2 Mar 1998 16:25:19 GMT
From: scott@softbase.com
Subject: Re: Faxing from Perl
Message-Id: <6demhf$hm5$1@mainsrv.main.nc.us>

> is there any way I can fax a document/text file in Perl on
> a win32 based NT platform?
> Maybe I can use an external program or something.

The easiest way would be to use Automation to control Word (or
something else with advanced printing features) and have it print to
the fax driver. I don't think you could do noninteractive faxing,
unless the driver had presets that let it run w/o putting up dialogs.
I've never heard of a faxing Automation interface, but I've
never really looked either.

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: Mon,  2 Mar 1998 13:57:55 -0500
From: Michael D Sohn <msda+@andrew.cmu.edu>
Subject: gamma function or chi-square?
Message-Id: <0oyk4n200YUg022TU0@andrew.cmu.edu>


I need to do a chi-squared estimate.  Is there a chi-square function or
a gamma function script available anywhere?  Where could I search for
one?

thanks,
Mike.



------------------------------

Date: Mon, 02 Mar 1998 13:01:01 -0500
From: Neal Kaiser <shanahjc@ibm.net>
Subject: GDBM for WinNT
Message-Id: <34FAF3DD.59471C0C@make-a-store.com>

I have written a program that I want to port to NT. But it uses GDBM
files. Any idea where I can find GDBM for WinNT and a Perl for Win32
which has that module?

Thanks,
Neal
neal@make-a-store.com



------------------------------

Date: 2 Mar 1998 19:42:13 GMT
From: ftl@shell. (Fay-Tjung Liu)
Subject: Help: can't load library error when trying to execute cgi(perl)script
Message-Id: <6df22l$cp3$1@news.ncal.verio.com>

Hi,
I got Internal Server Error when I tried to execute my cgi script.
I believe that my server is set up correctly because test-cgi file runs
fine.
The following is the error message from error_log file
--------------------------------------------------------
perl: can't load library 'libdb.so.1'
[Mon Mar 2 11:06:05 1998] access to /var/lib/httpd/cgi-bin/test.cgi
failed for carina44.wco.com, reason: Premature end of script headers
--------------------------------------------------------

The following is my simple script test.cgi
--------------------------------------------------
#!/usr/bin/perl
print STDOUT "Content-Type: text/html\n";
print STDOUT "\n";
print STDOUT "<title> this is a test</title>\n";
print STDOUT "<b> CGI testing is successful</b>\n";
---------------------------------------------------

I have put libdb.so.1 directory path in ld.so.conf and run ldconfig
afterward but I still got the same error message.

I am not sure if the following is related, I get the following warning
everytime I run perl script in console
-------------------------------------------------
perl: warning: Setting locale failed.
perl: warning: Please check that your locale setting:
        LC_ALL = (unset),
        LANG = "EN"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
--------------------------------------------------------

Any help is very much appreciated

Thanks in advanced
Andrew
ftl <at> wco <dot> com


------------------------------

Date: Mon, 02 Mar 1998 14:15:22 -0500
From: AutomatedAudit <auditbot@us.ibm.com>
Subject: How to get password-protected documents on Web?
Message-Id: <34FB054A.F0BE118@us.ibm.com>

I'm using libwww-perl to get documents from a web server. This server is
now password protected, and the "get" command now returns an error. How
do I send a user ID and password along with my "get" command? Thanks
all.



------------------------------

Date: Mon, 2 Mar 1998 17:12:40 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: interpolation in subroutine calls
Message-Id: <Ep7Bt4.Mwq@world.std.com>

shawn_worsencroft@intercept.com writes:

>I am trying to send an interpolated value in a call to a subroutine.
>It's not working, this is what it looks like:

>###########################################
>my $configurations = q("Postscript, Postscript, 5, 0", DLG_TRUE);

>my $config_menu =   Dialog::dialog__define_label_scroll_entry(
> "$configurations" );
>###########################################

Can you change $configurations so that it is an array instead of a
single scalar?

my @configurations = ("Postscript, Postscript, 5, 0", DLG_TRUE);

my $config_menu =   Dialog::dialog__define_label_scroll_entry(
 @configurations );


If not, how about using the Text::ParseWords module?

use Text::ParseWords;

my $configurations = q("Postscript, Postscript, 5, 0", DLG_TRUE);

my $config_menu =   Dialog::dialog__define_label_scroll_entry(
 quotewords(',', 1, $configurations);


If not, how about splitting up the string with the method shown in

<URL:http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq4/
How_can_I_split_a_character_de.html>

-- 
Andrew Langmead


------------------------------

Date: Mon, 2 Mar 1998 19:08:29 GMT
From: saseao@unx.sas.junkmail.com (Ed Overton)
Subject: ksh2perl converter?
Message-Id: <34fc0106.366955515@newshost.unx.sas.com>

Hi all,
   I'm looking for a ksh to perl converter.  I've got quite a number of ksh
scripts that I'll need to convert, and I'd rather not write a converter
myself...

Thanks in advance,
Ed
------------------------------------------------
                  Ed Overton
          saseao@unx.sas.junkmail.com
To reply, remove junkmail from the above address
------------------------------------------------


------------------------------

Date: Mon, 02 Mar 1998 10:03:49 -0800
From: "Charles Jaimet" <webmaster@netminder.com>
Subject: Location: and targets help
Message-Id: <34faf386.0@news.westel.com>

Hi all,

I'm using a perl script to redirect users from a drop down menuwith the
following line:

print "Location: ", $in{'url'}, "\n\n";

But I have to specify the target frame/window in the form statement (ie. in
HTML).

Is there a way to set the target in PERL?

Charles


------------------------------

Date: Mon, 02 Mar 1998 17:57:07 GMT
From: nospam@dana.ucc.nau.edu (Brian Sawert)
Subject: Re: Looking for a program called 'Brief'
Message-Id: <34fbf299.240076501@usenet.nau.edu>

On 27 Feb 1998 18:25:27 GMT, sanjay@ssc.sas.upenn.edu (Sanjay Sinha)
wrote:

>During the years 1990-91, i had a part time job (date entry) at a
>linguistics lab.
>There was a DOS program called 'BRIEF', which they used. Being myself, 
>i simply could not resist playing around with it.
>
>The features I can remember are
>- it was a text editor.
>- very powerful search/replace via 'regular expression'
>- keystroke macros and immense level of customization.
>- Create .exe applications for stand alone processing
>- the company was based out of Boston.
>- lady at tech support had a really se^Hweet voice.
>
>Search engines and libraries are not of much help with a keyword like 'brief'.
>
>Is that program still around? Evolve into another product?
>Any info appreciated. 

Borland bought the product. I don't know if they still sell or support
it.

You're right, it was one of the best text editors made. I've tried
some Brief clones, but none really come close to the original.

------------------------------------------------------------
Brian Sawert
Information Technology Services
Northern Arizona University


------------------------------

Date: Mon, 2 Mar 1998 11:36:46 -0800
From: "Mishra, Aditya" <mishra.aditya@emeryworld.com>
Subject: Re: Multiple Packages per *.pm
Message-Id: <6devmj$1p0i@ljcqs003.cnf.com>

I think it would be very un-perl like if this "feature" is removed ;-)





------------------------------

Date: 02 Mar 1998 13:19:16 -0600
From: Quentin  Fennessy <quentin@jihad.amd.com>
Subject: Re: need info on obtaining perl for windows 3.1
Message-Id: <ximogzo6guj.fsf@jihad.amd.com>

>>>>> "SZ" == Stan Zylowski <ir767@cleveland.Freenet.Edu> writes:

    SZ> hi cant seem to find perl for windows 3.1 i do have a book
    SZ> with cd rom which says it has compiled ports of perl...

Check out the perl home page at www.perl.com.  There are pointers
there to Windows versions of Perl.

-- 
Quentin Fennessy			AMD, Austin Texas


------------------------------

Date: 2 Mar 1998 19:13:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: newbie: breaking a line of text into two chunks
Message-Id: <6df0bs$79g$1@marina.cinenet.net>

xewj@odin.sunquest.com wrote:
: In article <34EE18D0.1559581B@xaostools.com>,
: Joe Wahrhaftig  <joew@xaostools.com> wrote:
: >I've got a database where the entries are as follows
: >            item1_name        "comment string for item 1"
: >            item2_name        "comment string for item 2"
: >
: >I want to take the item_name and "comment about item n" and store them
: >in different variables. I tried reading these two entries per line with
: >a split as shown below:
: >[etc.]
: 
: s/^(\S+)\s+(".*")$/$item=$1;$comment=$2;/e;

Why go to the trouble of destructively substituting when this

  ($item, $comment) = /^(.*?)\s+(.*)/;

works just as well?

For that matter,

  ($item, $comment) = split ' ', $_, 2;

might be an even better choice.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Mon, 02 Mar 1998 13:10:57 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Online Perl Guru (Was:Re: Conflict in this Newsgroup)
Message-Id: <34FB0441.35B1E14F@gpu.srv.ualberta.ca>

Jen Lyons wrote:

[snip]

! Keep in mind, though, that the mini-FAQ is one document.  The
! rest of the FAQs that I've seen mentioned are numerous, and if
! you're new to Perl, you may not know where to look.

For all those who might not know where to look for answers,
You're in luck...

The Perl Doctor is in!

That's right...fast online access to answers to all sorts
perl questions ranging from simple to more advanced, and that's 
not all! Also available are a great many categorized
pages of in-depth and insightful discussions on everything from
running perl with 'special' commandline switches to building
complex datastructures to embedding perl.

No longer need you suffer the delays of posting your question to
comp.lang.perl.misc and hoping for an answer from someone who is
probably already using this insanely great device. No more flames
and insults.  No more relying on others for help.

Within minutes of starting to use this ingenious tool you'll be
finding the answers and the information you need to get your job
done! You'll be amazed at how easy it can be to impress your boss,
your co-workers, your friends, even your spouse with your
knowledge of Perl...("Who the hell is this Pearl person and how
do you know so much about her?!" ... ok, maybe not your spouse).

No longer just shared among those 'in the know', this incredible tool
is available to you right now and without cost---yes, Free! In
fact, if you have perl you already have access to this miracle
tool (if you don't have perl, get it). All you'll need to
get started with this wonder-tool are a few magical incantations:

shhh...

To begin, go to your commandline prompt and enter:
perldoc perldoc

Want to know what else perldoc can tell you about perl?
perldoc perl

Interested in seeing a list of what questions are answered where,
and details on what other topics are available?
perldoc perltoc

Want to know how to use a particular function(split? grep?):
perldoc -f split
perldoc -f grep

And there's much, much more...

Here is what some people have said already:

    "It's great!"  -- Tony T. Tiger
    
    "Yow!  Am I in Milwaukee?"  -- fortune
    
    "Documentation is like sex: when it is good, it is very, very
     good; and when it is bad, it is better than nothing."
                    -- Dick Brandon

    "If one studies too zealously, one easily loses his pants."
                -- A. Einstein.
                
    "If you were my wife, I'd drink it!"   -- Winston Churchill

So don't delay, be the first on your block to begin 
taking advantage of this priceless tool.

*disclaimer: quoted statements may not have anything at all *
*            to do with the subject matter of this article. *

andrew
perl -e "print qq|just another perldoc FAQ'r :-)\n|"


------------------------------

Date: Mon, 02 Mar 1998 08:59:06 -0800
From: "Brian L. King" <blk@redneck.intel.com>
Subject: Re: Question for Tom Christiansen
Message-Id: <34FAE55A.41C67EA6@redneck.intel.com>

Robert Mac wrote (Subject: Question for Tom Christiansen):
> 
> Dear Tom
> 
> I'm sorry to disturb you, I hope you don't mind answering the following
> question.

Given some of the recent threads in this newgroup, I'd bet a buck that
Tom has killfiled ($subject =~ /Tom Christiansen/i) postings.... 
Wouldn't blame him ,anyway.  ;-)

-- 
----------------------------------------------------------------------
Brian L. King
m/blk@(jf\.)?intel\.com/
Server Engineering, Intel Corporation.  Hillsboro, Oregon
I do not speak for anyone but myself, and when I do, I feel strongly
about it.


------------------------------

Date: Mon, 2 Mar 1998 10:29:55 -0800
From: "Creede Lambard" <fearless@nospam.io.com>
Subject: Re: Regional PUGs
Message-Id: <6detuf$r8d@news.microsoft.com>

Apparently a new one is being started in Seattle this month. Email
tim@consultix.wa.com for more information.

-- Creede

brian d foy <comdog@computerdog.com> wrote in message
news:comdog-ya02408000R0203980516050001@news.panix.com...
>In article <34F59C87.DB2076F0@micro.ti.com>, Holly Sommer
<hsommer@micro.ti.com> posted:
>
>>PUG - Perl User Groups.
>>
>>I was wondering if there are any such beasties out there... and if not,
>>whether there might be interest in forming any as such.
>
>so far i know of at least six such groups.  Perl Mongers can either
>help you find one or start one :)
>
>--
>brian d foy                                  <comdog@computerdog.com>
>Perl Mongers <URL:http://www.pm.org>
>Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>




------------------------------

Date: 2 Mar 1998 12:40:06 -0500
From: crusader@bilbo.ShireNet.com (Scott Cherkofsky)
Subject: running a long script without waiting?  HELP! exec() didn't work!
Message-Id: <6deqtm$puc@bilbo.ShireNet.com>

I've run into a problem that does not seem to be adequately covered in any book or FAQ...

I've got a PERL script which provides feedback to the users (to a web page) based on their selections 
in a HTML form.  It then launches another PERL script which runs some C modules running on the server 
(Solaris).

The script is set up like this:

	1.  read in the form data
	2.  parse the data and save it to a job file (what to run and when to run it)
	3.  show the user what they submitted (print statements to a web page through CGI)
	4.  launch the PERL script which runs the C modules on the UNIX box.

The problem is, sometimes the C modules can take forever to run and the second PERL script waits for 
them to finish.  This in turn makes the first PERL script wait before it displays any input form 
feeback to the user.

I've tried using the exec() function (with an autoflush) but the input feedback is still waiting until 
the C modules finish running.  I've tried sending the command in the exec() call with an '&' to get the 
stuff to run in the background but the same thing happens.

I've also tried the system() and backquote method just for kicks but these are supposed to wait for the 
process to finish before continuing with the current script (unlike exec()).

Anyway, I'm at the end of my rope on this - this is the key to getting my stuff to work.  Any help will 
be much appreciated.

Scott
semi-newbie but with a well stocked PERL library

-- 
____________________________________________________________________________
  Scott   |   scottc1033 aol com  | Need Interenet access in Virginia?
Cherkofsky|crusader shirenet com  |  Try Shirenet <mailto:info@shirenet.com>
'Crusader'|HomePage:    http://www.shirenet.com/~crusader/html/Home.html


------------------------------

Date: 2 Mar 1998 12:54:07 -0600
From: jima@MCS.COM (Jim Allenspach)
Subject: Re: running a long script without waiting? HELP! exec() didn't work!
Message-Id: <6dev8f$d70@Venus.mcs.net>

>I've run into a problem that does not seem to be adequately covered in
> any book or FAQ...

	Sure it is! You just need to know how to phrase your question
properly.

> [...]
>The problem is, sometimes the C modules can take forever to run and the
> second PERL script waits for them to finish.  This in turn makes the
> first PERL script wait before it displays any input form feeback to
> the user.

	So, you want to start the process for the second Perl script in the
background? A good place to start would be the Perl FAQ[1], right where it
says:

	"How do I start a process in the background?"

and see where that leads you.

	Note, however, that if you really do have to wait for the C stuff
to finish before you can continue, then you're kinda stuck. Unless, of
course, you can speed up the C (see comp.lang.c (please?) for that, obv).
Hope this helps.
jma


[1] FAQ URL, FYI: http://language.perl.com/faq/index.html

-- 
jima at mcs dot com
Chicago, IL                     Perl programmers do it
http://www.streams.com/jima/      with one hump.


------------------------------

Date: Mon, 02 Mar 1998 13:21:48 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Scalar variable problem!
Message-Id: <34FB06CC.BEFE5F83@houston.Geco-Prakla.slb.com>

Daniel wrote:
> 
> Does anyone know if  there is any limit to the number of characters in a
> string / scalar variable?
To the best of my knowledge (I can't check the book cause I left it at
home.  Dooh!), the only limit on the size of strings and/or scalar
variables would be the amount of free memory on the machine.

What are you having trouble with?  Code snippet?  Errors given?  Perhaps
you have a limit on a filesize you are creating that is causing you
problems?

HTH.
> 
> -- daniel

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: 2 Mar 1998 14:07:31 -0500
From: jdudley@access1.digex.net (James Dudley)
Subject: shift doesn't, NEXT-to-last value?
Message-Id: <6df01j$dqt@access1.digex.net>

Hello, all.
	I am reading the new Camel book, trying examples.  I have made
a simple example for "shift" but do not understand the results.
(Running 5.004).

---------------------------------------
#!/usr/bin/perl
#  Program to test push and pop

@foo = ("aa","bb","cc","dd","ee");

foreach $foo (@foo) {
   print "Before shift:\t@foo\n";
   shift @foo;
   print "After shift:\t@foo\n\n";
}
print "After loop, foo = @foo\n";
print "\n";
---------------------------------------

This outputs:
---------------------------------------

Before shift:	aa bb cc dd ee
After shift:	bb cc dd ee

Before shift:	bb cc dd ee
After shift:	cc dd ee

Before shift:	cc dd ee
After shift:	dd ee

After loop, foo = dd ee
---------------------------------------

Why doesn't the loop go one more time, so
the last entry is

After shift:	dd

??
Yes, I've read the perlfunc pod, and it says that "If there are no
elements in the array, returns the undefined value."  But it seems
to me that the loop I have written should work ONE more time than it
does.  What's going on with that?  Thanks for your help.

Jane (not James)




------------------------------

Date: 02 Mar 1998 14:39:07 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: shift doesn't, NEXT-to-last value?
Message-Id: <ra4kj31g.fsf@news.concentric.net>

jdudley@access1.digex.net (James Dudley) writes:

> 	I am reading the new Camel book, trying examples.  I have made
> a simple example for "shift" but do not understand the results.

> #!/usr/bin/perl
> @foo = ("aa","bb","cc","dd","ee");
> foreach $foo (@foo) {
>    print "Before shift:\t@foo\n";
>    shift @foo;
>    print "After shift:\t@foo\n\n";
> }

I don't think you want to be mucking about with the contents of @foo
while you're doing a foreach on it.  A better algorithm might be

my $elements_in_foo = @foo;
for (my $i = 0; $i < $elements_in_foo; $i++) {
    print "Before shift:\t@foo\n";
    shift @foo;
    print "After shift:\t@foo\n\n";
}

More perlish would be

while (@foo) {
   blah blah;
   shift @foo;
}

foreach is used to do something to/with the elements of an array (or a
list).  Hope this helps a bit.
-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


------------------------------

Date: 2 Mar 1998 18:49:19 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: SQL sytax in Perl? Do you know....
Message-Id: <6deuvf$bdh$1@news.orst.edu>

In article <34FAC4EC.58DF7ED2@mindless.com>,
Fain  <mindmore@mindless.com> wrote:
>I'm trying to find a fast way to use SQL (postgress and mSQL in
>particular) in a perl script. This is what I have been using:
>
># Query the database (in SQL), then print to a file ($file) using -o
>
>Is there any other way to query a SQL database in Perl??
>Is there any way that I can eliminate having to write to another file
>and then accessing that file to print from the database???

You can probably avoid the file by opening the command for read. E.g.,

open( D, "postgres -c 'query' |" ) || die "can't open postgres: $!\n";
while(<D>) {
	...







------------------------------

Date: 2 Mar 1998 19:30:06 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Strict
Message-Id: <6df1bu$79g$2@marina.cinenet.net>

Francesc Guasch (frankie@etsetb.upc.es) wrote:
: Hi, I want to use strict but what if I wanted to use
: a globar variable ?

I presume you mean 'global.'  The trick is:

  use vars ( '$foo' '%bar' '@baz' );

This explicitly declares your intention to use these global variables, 
thus making 'strict' happy.

: using ::DIRLIST in a sub makes perl complain :
: 
: Bareword "::DIRLIST" not allowed while "strict subs" in use at ./Llistes.pl line
:  8.
: Execution of ./Llistes.pl aborted due to compilation errors.

As well it should, given that you've left the type character off the 
beginning.  Try @::DIRLIST (if it is in fact a list) instead.

: Do I have to pass that variable to the subroutine also ?

No, but almost always, passing values around rather than using globals is 
a good idea.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Mon, 02 Mar 1998 11:23:09 -0800
From: Namsuk Kim <a-namsuk@microsoft.com>
Subject: Telnet prompt: how type username and password automatically?
Message-Id: <34FB071C.3AF7513C@microsoft.com>

I want to make a script that telnet to a unix machine(s) and logs-in
automatically.
Scripting platform are NT and Linux to other variety of Unices.  There
is no problem to give a command 'telnet machinename'.  However, after
that, it's stuck.

To be detail,    1. Telnet system
                      2. Wait for login prompt
                      3. Type login name
                      4. Wait for passwd prompt
                      5. Type passwd
                      6. Wait for prompt
                      7. Exit and close connection.

If there is a script, it will be great.  Or, direct me to help is also
great.

TIA
Namsuk Kim
a-namsuk@microsoft.com  <--- reply to this address.



------------------------------

Date: 2 Mar 1998 19:46:56 GMT
From: zbir@chaumas.suits.kiva.net (Zachery J. Bir)
To: a-namsuk@microsoft.com
Subject: Re: Telnet prompt: how type username and password automatically?
Message-Id: <slrn6fm31u.2r7.zbir@chaumas.suits.kiva.net>

[posted and replied]

On Mon, 02 Mar 1998 11:23:09 -0800, Namsuk Kim <a-namsuk@microsoft.com> wrote:
>I want to make a script that telnet to a unix machine(s) and logs-in
>automatically.
>Scripting platform are NT and Linux to other variety of Unices.  There
>is no problem to give a command 'telnet machinename'.  However, after
>that, it's stuck.
>
>To be detail,    1. Telnet system
>                      2. Wait for login prompt
>                      3. Type login name
>                      4. Wait for passwd prompt
>                      5. Type passwd
>                      6. Wait for prompt
>                      7. Exit and close connection.
>
>If there is a script, it will be great.  Or, direct me to help is also
>great.

Never actually played with it, but you may look at expect. It's not perl, 
and it requires Tk (and maybe X11). You can find more info at:

  http://expect.nist.gov/

Zac



------------------------------

Date: Mon, 2 Mar 1998 13:52:27 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: What does this one-liner do?
Message-Id: <1152B1EB58892BE3.602C24B6B4BBCDB7.2055108DE1C198F5@library-proxy.airnews.net>

John Porter <jdporter@min.net> wrote:

>   $c = ( ($x,$y) = @a );
>   $d = ( ($x,$y) = (7,8,9) );
> 
> $c gets the number of elements in @a, and
> $d gets the number of elements in (7,8,9).

I understand (I think) everything except why

($l,$m, $n) = ( ($x,$y) = (7,8,9) );

Doestn't result in 7 8 9, instead it's just 7 8.

-- 
John Moreno
I am trying to convince the author of YA-NewsWatcher that the latest
version should be released to the public.  He doesn't think there's much
interest in a new version.  Help me prove him wrong.  To do so, send me
mail <mailto:phenix@interpath.com> with a Subject of New YA.  Comments
on what you like/dislike in the current version will be appreciated.


------------------------------

Date: Mon, 02 Mar 1998 14:14:54 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: What does this one-liner do?
Message-Id: <linberg-0203981414540001@projdirc.literacy.upenn.edu>

In article
<1152B1EB58892BE3.602C24B6B4BBCDB7.2055108DE1C198F5@library-proxy.airnews.net>,
phenix@interpath.com (John Moreno) wrote:

> John Porter <jdporter@min.net> wrote:
> 
> >   $c = ( ($x,$y) = @a );
> >   $d = ( ($x,$y) = (7,8,9) );
> > 
> > $c gets the number of elements in @a, and
> > $d gets the number of elements in (7,8,9).
> 
> I understand (I think) everything except why
> 
> ($l,$m, $n) = ( ($x,$y) = (7,8,9) );
> 
> Doestn't result in 7 8 9, instead it's just 7 8.

Because the 9 gets lost when $x eats 7 and $y eats 8.  The 9 doesn't go
anywhere.  You're left with 7 and 8.
_____________________________________________________________________
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


------------------------------

Date: 2 Mar 1998 14:12:40 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: What does this one-liner do?
Message-Id: <6df0b8$cmr@ocean.CAM.ORG>

In article <1152B1EB58892BE3.602C24B6B4BBCDB7.2055108DE1C198F5@library-proxy.airnews.net>,
John Moreno <phenix@interpath.com> wrote:
>
>I understand (I think) everything except why
>
>($l,$m, $n) = ( ($x,$y) = (7,8,9) );
>
>Doestn't result in 7 8 9, instead it's just 7 8.
>

Context is everything.  And in the above you changed the context of the
leftmost assignement from scalar to list.  So it gets the results of the
"($x, $y)" assignement *in a list context*, which is (7, 8).

Richard.
-- 
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
    "All along this path I tread  /  My heart betrays my weary head
     With nothing but my love to save / From the cradle to the grave"
                                 (Eric Clapton, "From the cradle")


------------------------------

Date: 2 Mar 1998 17:19:43 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Why doesn't "tr/\x0D//d" work?
Message-Id: <6depnf$42p@news-central.tiac.net>

In article <6demf7$7lo@angel.uunet.ca>, Dave Till <davet@angel.uunet.ca> wrote:
>In article <slrn6fdmth.ij7.Tom.Grydeland@mitra.phys.uit.no>,
>Tom Grydeland <Tom.Grydeland@phys.uit.no> wrote:
>>On Fri, 27 Feb 1998 12:52:49 GMT,
>>Fred Vaughn <spam@no_spam_please.com> wrote:
>>> open(INFILE, $ARGV[0] ) || die "Error unable to open filename: $infile $!";
>>                                     Did you mean $ARGV[0] here? ^^^^^^^
>>
>>> while ( $line = <INFILE> )
>>
>>Hmm, you didn't use -w, did you?
>
>Is "while ($line = <INFILE>)" now considered Bad Perl?
>The Camel uses this looping construct rather frequently
>(indeed, it sometimes goes whole hog and uses "while (<>)").

There is a *big* difference between the following conditions apart from
one assigning to $_ and one to $line.

  while ($line = <INFILE>) 

and

  while (<INFILE>)

When <...> is the only thing in the conditional of a while perl now
automagically turns it into

  while (defined ($_ = <...>))

which makes a big difference if the last record of the input file is just
the single character 0

To quote the perlop docs:

       [...] If and ONLY if the input symbol is
       the only thing inside the conditional of a while or
       for(;;) loop, the value is automatically assigned to the
       variable $_.  The assigned value is then tested to see if
       it is defined.  (This may seem like an odd thing to you,
       but you'll use the construct in almost every Perl script
       you write.)  Anyway, the following lines are equivalent to
       each other:

           while (defined($_ = <STDIN>)) { print; }
           while (<STDIN>) { print; }
           for (;<STDIN>;) { print; }
           print while defined($_ = <STDIN>);
           print while <STDIN>;

In general I try and make code -w clean while developing it and then take
out the -w flag as it's fragile in the face of future perl changes.

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


------------------------------

Date: Mon, 2 Mar 1998 18:44:56 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Why doesn't "tr/\x0D//d" work?
Message-Id: <Ep7G2x.IM9@world.std.com>

davet@angel.uunet.ca (Dave Till) writes:

>Is "while ($line = <INFILE>)" now considered Bad Perl?
>The Camel uses this looping construct rather frequently
>(indeed, it sometimes goes whole hog and uses "while (<>)").

But for quite a few versions of perl now, "while(<>)" does not equal
"while($_=<ARGV>)", but instead it means "while(defined($_=<ARGV>))."
For programmers using this common perl idiom, their code had a bug in
when run in previous versions of the interpreter that is now
fixed. For programmers that didn't use it, the warning message should
tell them of the possible bug.


>Should the goal be to *always* eliminate *all* warning messages
>from your code?

Only the ones that you know will not cause bugs in your programs. I
doubt many people want to intentionally ignore the last line of input
if it contains a lone "0" without a newline.

If you know that a particular section of code will generages a
spurious warning. (I personally really hate the "argument isn't
numeric" warning. Maybe I want to sort strings like "123abc"
numerically.) You can always disable in a a section of code by
toggling $^W.

-- 
Andrew Langmead


------------------------------

Date: 2 Mar 1998 19:19:21 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Why doesn't "tr/\x0D//d" work?
Message-Id: <slrn6fm1ho.ie7.Tom.Grydeland@mitra.phys.uit.no>

On 2 Mar 1998 11:24:07 -0500,
Dave Till <davet@angel.uunet.ca> wrote:

> Is "while ($line = <INFILE>)" now considered Bad Perl?

In the sense that a broken9 input file can stop your script prematurely;
yes.  A lone "0" (without the "\n") on the final line of a text file
will stop your script at that point.  Hence the warning, and the
suggestion from perldiag.

> The Camel uses this looping construct rather frequently

Yes, that has baffled me as well.

> (indeed, it sometimes goes whole hog and uses "while (<>)").

Which, OTOH, is perfectly OK, as Mike Stok has already pointed out.

> Should the goal be to *always* eliminate *all* warning messages
> from your code?

That depends.

Personally, I like my programs (scripts, thingamajigs, whatchamacallits)
to be as silent as possible.  Any noise is there to catch my attention,
and then it had better be something that requires my attention.
I can use several constructs that provoke warnings in Perl, but then I
do it on purpose, and i turn off warnings locally with local($^W)=0;

If the script is for your own use, and you know that your
input never contains such a broken file (and even if it did, and one of
your scripts should stop prematurely, nothing serious would happen),
the above warning should not be of a concern to you, and you can turn it
off.  Hopefully, you'll do it locally.

Apart from that, I quite like having references to $_ running like an
invisible thread through my programs.  I find this makes them easier to
read and harder to break than programs cluttered with variable
assignments, =~s and excessive punctuation.2

9IIRC, to be a valid text file, every line *including the last one*
 shall end with a "\n".  Emacs allows you to create such a file.  vi
 does not (and complains if you open such a file).

2Paraphrasing and contradicting the statements of Dave Till in
 _Teach yourself PERL 5 in 21 days_, 2/e

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


------------------------------

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 2003
**************************************

home help back first fref pref prev next nref lref last post