[11704] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5304 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 5 19:06:25 1999

Date: Mon, 5 Apr 99 16:00:19 -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           Mon, 5 Apr 1999     Volume: 8 Number: 5304

Today's topics:
        Backslash: unclear on the concept (Dmitry Epstein)
    Re: Can some one debug this perl - I need help <cassell@mail.cor.epa.gov>
    Re: constructing a list of hashes (Larry Rosler)
    Re: constructing a list of hashes (Larry Rosler)
    Re: constructing a list of hashes <jglascoe@giss.nasa.gov>
    Re: constructing a list of hashes <uri@home.sysarch.com>
    Re: Help for grep... <cassell@mail.cor.epa.gov>
    Re: here docs vs qq quote operator. Just personal prefe (Larry Rosler)
        How do I simply delete a file in CGI? <Moritz@warzone.com>
    Re: How do I simply delete a file in CGI? (Bob Trieger)
        How do I turn this 1000000 into this 1,000,000 in Perl? <indexfinger@usa.net>
    Re: How do I turn this 1000000 into this 1,000,000 in P (Sam Holden)
    Re: How do I turn this 1000000 into this 1,000,000 in P (Bob Trieger)
    Re: HTTP document transfers (Larry Rosler)
        Limit 10 matches to display on screen <00224166@bigred.unl.edu>
    Re: perl and y2k (was Re: The millennium cometh -- even (Alan Barclay)
    Re: perl and y2k (was Re: The millennium cometh -- even <uri@home.sysarch.com>
    Re: Premature end of script headers (Larry Rosler)
    Re: Premature end of script headers (Randal L. Schwartz)
        Q: Error: No child processes anna@water.ca.gov
    Re: Question regarding databases and unwanted data buil (Larry Rosler)
    Re: Speed of PERL <cassell@mail.cor.epa.gov>
    Re: This proverbial "perldoc". (Bob Trieger)
    Re: This proverbial "perldoc". <cassell@mail.cor.epa.gov>
    Re: This proverbial "perldoc". <grichard@uci.edu>
        Trouble with Oraperl, and simple select statement (Darren Greer)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 05 Apr 1999 22:06:03 GMT
From: mitiaNOSPAM@nwu.edu (Dmitry Epstein)
Subject: Backslash: unclear on the concept
Message-Id: <3709306b.28197127@news.acns.nwu.edu>

This may seem like a trivial question, but sometimes even bright
people like myself  get stuck with something like this and need
someone's help :)  I looked in the documentation and the FAQ, but
couldn't find the answer.

My question is: how exactly does backslash (\) work in string
literals?

I came upon this when I tried to assign something like this:

	\Qsomething\E

to $foo, and later use $foo as a regular expression:

	/$foo/

As it turned out, the one method that works is

	$foo = "\Qsomething\E";

However I don't understand why neither of the following will work:

	$foo = '\\Qsomething\\E';
	$foo = "\\Qsomething\\E";

And why then, when I print "\Qsomething\E" I don't see the
backslashes?


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

Date: Mon, 05 Apr 1999 15:16:34 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
To: ACE Alex <alex@saers.com>
Subject: Re: Can some one debug this perl - I need help
Message-Id: <37093642.EB4985F2@mail.cor.epa.gov>

[courtesy copy mailed to poster]

ACE Alex wrote: 
> Uhh, what? Can you compile perl scripts to binarys?
> /alex
> alex@saers.com
> 
> Jay Glascoe wrote in message <37090B1F.C40ED597@giss.nasa.gov>...
> >Mike Tickle wrote:
> >>
> ><snip>
> >
> >your code won't even compile: you have no curly
> >braces, "{}", attached to the foreach loop.

Alex,
   What Jay is referring to is the process by which Perl takes
a text file and turns it into something it can run.  Perl compiles
the text into a bytecode representation first.  If the code won't
compile, it can't be run.  Jay is explaining that the code cannot
yet be run, since it won't get through the compile-time part of
the process.

HTH, 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 5 Apr 1999 15:07:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: constructing a list of hashes
Message-Id: <MPG.1172d41c5f8436f2989835@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <x7emlyvjug.fsf@home.sysarch.com> on 05 Apr 1999 17:27:35 -
0400, Uri Guttman <uri@home.sysarch.com> says...
 ...
> $_ = 0 foreach @hash{keys %hash} ;
> 
> since that creates a list of lvalues (the values BTW, not the keys)
> which can be aliased to $_.
> 
> it makes no sense to do the same or something similar with the values
> func.

>From the other responses, I ascertain that in as-yet-not-generally-
released versions of perl, the values() function produces a list of 
lvalues, so it makes a great deal of sense.

> but if that is all you want to do then a simpler method is:
> 
> @hash{keys %hash} = (0) x (keys %hash / 2);
> 
> the /2 might even be optional if you don't mind generating a longer list
> of (0) and throwing the second part away in the assignment.

I can't help thinking you have gone off the track here.  '{keys %hash}' 
on the left side produces exactly as many elements as 'x keys %hash' 
does on the right side, not twice as many.
 
> @hash{keys %hash} = (0) x keys %hash ;

So this is correct, but not the previous one.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 5 Apr 1999 15:15:12 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: constructing a list of hashes
Message-Id: <MPG.1172d5cb222b25c989836@nntp.hpl.hp.com>

In article <37092782.F7116697@giss.nasa.gov> on Mon, 05 Apr 1999 
17:13:38 -0400, Jay Glascoe <jglascoe@giss.nasa.gov> says...
 ...
> Larry Rosler quotes the perlsyn manpage:
> 
> > "If any element of LIST is an lvalue, you can modify it by modifying VAR
> > inside the loop. That's because the foreach loop index variable is an
> > implicit alias for each item in the list that you're looping over."
> 
> and then points out that each element of "values %hash"
> is an *rvalue*.  So, although the first sentence doesn't
> say "only if", maybe this feature should be removed
> from perl5.005_55 ?

As there is a patch for newer versions that produces a list of lvalues 
from values(), why not leave the capability in and document it under 
values() -- assuming there is no significant performance hit, of course?

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 05 Apr 1999 18:26:39 -0400
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Uri Guttman <uri@home.sysarch.com>
Subject: Re: constructing a list of hashes
Message-Id: <3709389F.B353851F@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Uri Guttman wrote:
> 
> this should be an FAQ already. the trick is to use a hash slice:
> 
> $_ = 0 foreach @hash{keys %hash} ;

<snip>

> but if that is all you want to do then a simpler method is:
> 
> @hash{keys %hash} = (0) x (keys %hash / 2);
> 
> the /2 might even be optional if you don't mind generating a longer list
> of (0) and throwing the second part away in the assignment.

but the [missing] parens around %hash are not optional  ;^)

> hth,
> 
> uri

En Garde!

use strict;
use Benchmark;

open FH, "< /usr/dict/words" or die $!;

chomp(my @words = <FH>);
my %hash = ();
@hash{@words} = (); # all values are undefined     

my $subs = {
    code_1 => sub { $_ = 0 foreach @hash{keys %hash} },
    code_2 => sub { $_ = 0 foreach values %hash },
    code_3 => sub { @hash{keys %hash} = (0) x (keys(%hash) / 2) },
    code_4 => sub { $hash{$_} = 0 foreach keys %hash },
};

timethese(10, $subs);
__END__

Benchmark: timing 10 iterations of code_1, code_2, code_3, code_4...
    code_1:  2 wallclock secs ( 2.79 usr +  0.00 sys =  2.79 CPU)
    code_2:  1 wallclock secs ( 0.91 usr +  0.00 sys =  0.91 CPU)
    code_3:  3 wallclock secs ( 2.48 usr +  0.00 sys =  2.48 CPU)
    code_4:  3 wallclock secs ( 2.98 usr +  0.00 sys =  2.98 CPU)

	Jay Glascoe


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

Date: 05 Apr 1999 18:58:11 -0400
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: constructing a list of hashes
Message-Id: <x7zp4mu130.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  >> but if that is all you want to do then a simpler method is:
  >> 
  >> @hash{keys %hash} = (0) x (keys %hash / 2);
  >> 
  >> the /2 might even be optional if you don't mind generating a longer list
  >> of (0) and throwing the second part away in the assignment.

  LR> I can't help thinking you have gone off the track here.  '{keys %hash}' 
  LR> on the left side produces exactly as many elements as 'x keys %hash' 
  LR> does on the right side, not twice as many.
 
  >> @hash{keys %hash} = (0) x keys %hash ;

  LR> So this is correct, but not the previous one.

me stupid, you smart.

just trying to whip out a solution and for some reason my brain fritzes
and thinks scalar keys returns the count of all the keys/values and not
the number of keys

as we are about to hold the boston.pm tech meeting, i will sit in the
corner witha dunce cap on.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Mon, 05 Apr 1999 15:02:18 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Help for grep...
Message-Id: <370932EA.1A6779C7@mail.cor.epa.gov>

apple wrote:
> I would like to grep a word ->
> myname
> from a line ->
> <test>myname</test>
> 
> after I read this line to my perl file. How can I grep it as a $name=myname.
> 
> Help me ,please...

Okay...

Here's the exact [but useless in general] case you gave:

  $string = '<test>myname</test>';
  ($name = $string) =~ s#<test>(.*?)</test>#$1#

To do this in more generality, you'll have to read up on regexes
[type 'perldoc perlre'] and the s/// and m// operators [type
'perldoc perlop'].  To do this on html code, be sure to use
HTML::Parser  instead of trying to do this by hand.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 5 Apr 1999 15:35:52 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: here docs vs qq quote operator. Just personal preference?
Message-Id: <MPG.1172daa7fcfff87989838@nntp.hpl.hp.com>

In article <x7bth2vj8m.fsf@home.sysarch.com> on 05 Apr 1999 17:40:41 -
0400, Uri Guttman <uri@home.sysarch.com> says...
 ... 
> what i hate most is seeing " used on strings without any interpolation
> needed.  this is like the use of /s in regexes and no use of . in
> them. it is semantically misleading to the reader of the code and makes
> for harder maintenence later on. also backslashitis is painful to read
> as well as multiple print calls in a row. learn your string literals!

Amen, brother!  (Thank you, Sean :-)

But I make one exception that I believe would never semantically mislead 
anyone.  I always use "" for the null string, because '' is too easily 
read by a human as a starting double-quote.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 6 Apr 1999 00:11:04 +0200
From: "Moritz" <Moritz@warzone.com>
Subject: How do I simply delete a file in CGI?
Message-Id: <7ebcb7$sbm$1@news.worldonline.nl>

Am I stupid, or did they really forget to put that in the Perl language
reference?




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

Date: Mon, 05 Apr 1999 22:25:31 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: How do I simply delete a file in CGI?
Message-Id: <7ebd5u$q14$1@fir.prod.itd.earthlink.net>

"Moritz" <Moritz@warzone.com> wrote:
oo- Am I stupid, or did they really forget to put that in the Perl language
oo- reference?


perldoc -f unlink

Bob Trieger
sowmaster@juicepigs.com

"Contrary to popular belief, man can live on Ramen Noodles alone"    



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

Date: Mon, 05 Apr 1999 22:09:57 GMT
From: "IndexFinger.com" <indexfinger@usa.net>
Subject: How do I turn this 1000000 into this 1,000,000 in Perl?
Message-Id: <VwaO2.187$xI5.7172@typhoon.nycap.rr.com>

How do I turn this 1000000 into this 1,000,000 in Perl?




--
==================================================
SuggestSite - http://www.suggestsite.com
Word of mouth is the most powerful marketing tool.




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

Date: 5 Apr 1999 22:37:55 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: How do I turn this 1000000 into this 1,000,000 in Perl?
Message-Id: <slrn7gieq3.i02.sholden@pgrad.cs.usyd.edu.au>

On Mon, 05 Apr 1999 22:09:57 GMT, IndexFinger.com <indexfinger@usa.net> wrote:
>How do I turn this 1000000 into this 1,000,000 in Perl?

You read the documentation :

perlfaq5 : How can I output my numbers with commas added?

-- 
Sam

I don't want Perl to be beautiful--I want you to write beautiful
programs in Perl.
	--Larry Wall


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

Date: Mon, 05 Apr 1999 22:30:58 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: How do I turn this 1000000 into this 1,000,000 in Perl?
Message-Id: <7ebdg6$q14$2@fir.prod.itd.earthlink.net>

"IndexFinger.com" <indexfinger@usa.net> wrote:
oo- How do I turn this 1000000 into this 1,000,000 in Perl?

perlfaq5:
How can I output my numbers with commas added? 

Bob Trieger
sowmaster@juicepigs.com

"Contrary to popular belief, man can live on Ramen Noodles alone"    



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

Date: Mon, 5 Apr 1999 15:40:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HTTP document transfers
Message-Id: <MPG.1172dbba32eb78bb989839@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37092A9C.D921C04C@infomage.force9.co.uk> on Mon, 05 Apr 1999 
22:26:53 +0100, Infomage <infomage@infomage.force9.co.uk> says...
 ...
> use LWP::Simple;
> $inter = 'http://www.starlightlines.com/cgi-bin/messageread/emp/' .
> $MessNum . "\n";
> 
> print $inter;
> 
> $TheMain = get "$inter";  # Get the main page
 ... 
> Please feel free to point out the stupid mistake....  :o)

Could it be the newline at the end of $inter?  I don't know whether 
LWP::Simple::get() likes that.

(Can those quotes on a simple variable, by the way).

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 05 Apr 1999 17:08:34 -0500
From: gtan <00224166@bigred.unl.edu>
Subject: Limit 10 matches to display on screen
Message-Id: <37093462.8AC013DE@bigred.unl.edu>


--------------6E74330BBC70FDC15E5D7C52
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I am using win32:odbc and i am having trouble to display the next 10
results that matches the query. I use the following code so that only 10
results will display on screen each time

# Maximum Number of results to display
 $results = 10;

 while (($db->FetchRow()) && ($counter < $results))  {
 %Data = $db->DataHash();
 $counter++;
 if ($Data{REGADD2} eq "") {&printrecord2;}
 if ($Data{REGADD2} ne "") {&printrecord1;}

and the subroutine of the next page is as follow

sub nextpage
{
print "<a href=\"http://129.93.31.26/scripts/jamescal/contact.pl?query="
 . .
"&ADDRESSEE=" . $ADDRESSEE . "&YEAR=" . $YEAR . "&DATE=" . $DATE .
"&PLACE=" . $PLACE .
"&CATNUM=" . $CATNUM . "&ORIGINAL=" . $ORIGINAL . "&REPOSITORY=" .
$REPOSITORY .
"&PUBLISHED=" . $PUBLISHED . "\">
Next 10 Results</a>\n";

}

The results i get from pressing the Next 10 results is always the same
as the first 10 results display on frist page.  Can anybody tell me how
should i modify the next page subroutine so it won't display the same
results everytime.

--------------6E74330BBC70FDC15E5D7C52
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I am using win32:odbc and i am having trouble to display the next 10 results
that matches the query. I use the following code so that only 10 results
will display on screen each time
<p># Maximum Number of results to display
<br>&nbsp;$results = 10;
<p>&nbsp;while (($db->FetchRow()) &amp;&amp; ($counter &lt; $results))&nbsp;
{
<br>&nbsp;%Data = $db->DataHash();
<br>&nbsp;$counter++;
<br>&nbsp;if ($Data{REGADD2} eq "") {&amp;printrecord2;}
<br>&nbsp;if ($Data{REGADD2} ne "") {&amp;printrecord1;}
<p>and the subroutine of the next page is as follow
<p>sub nextpage
<br>{
<br>print "&lt;a href=\"<A HREF="http://129.93.31.26/scripts/jamescal/contact.pl?query=">http://129.93.31.26/scripts/jamescal/contact.pl?query=</A>"
 . .
<br>"&amp;ADDRESSEE=" . $ADDRESSEE . "&amp;YEAR=" . $YEAR . "&amp;DATE="
 . $DATE . "&amp;PLACE=" . $PLACE .
<br>"&amp;CATNUM=" . $CATNUM . "&amp;ORIGINAL=" . $ORIGINAL . "&amp;REPOSITORY="
 . $REPOSITORY .
<br>"&amp;PUBLISHED=" . $PUBLISHED . "\">
<br>Next 10 Results&lt;/a>\n";
<p>}
<p>The results i get from pressing the <i>Next 10 results </i>is always
the same as the first 10 results display on frist page.&nbsp; Can anybody
tell me how should i modify the next page subroutine so it won't display
the same results everytime.</html>

--------------6E74330BBC70FDC15E5D7C52--



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

Date: 5 Apr 1999 22:20:15 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: perl and y2k (was Re: The millennium cometh -- eventually)
Message-Id: <923350814.358418@elaine.drink.com>

In article <fred222-ya023580000504991721460001@news.bellatlantic.net>,
George <fred222@mauimail.com> wrote:
>$is_2000 = 0;
>if ($year>=100) { $is_2000 = 1;
>               $year = $year - 100; }
>if ($year<10) { $year = "0" . "$year"; }
>if ($is_2000) { $year = "20" . "$year"; }
>if ($year<100) { $year = "19" . "$year"; }
>
>$date = "$months[$mon] $mday $year";

That's a horribly complex way of getting a 4 digit year

$year += 1900;
$date = "$months[$mon] $mday $year";



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

Date: 05 Apr 1999 18:50:51 -0400
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: perl and y2k (was Re: The millennium cometh -- eventually)
Message-Id: <x74smuvfzo.fsf@home.sysarch.com>

>>>>> "G" == George  <fred222@mauimail.com> writes:


  G> The fact of the matter is, it's not that big of a deal to change
  G> the date from 100 to 2000.  Here's the code I've used again and
  G> again.. it works for me, but no guarantees about its greatness, eh?

how about slow and overkill?

  G> $is_2000 = 0;
  G> if ($year>=100) { $is_2000 = 1;
  G>                $year = $year - 100; }
  G> if ($year<10) { $year = "0" . "$year"; }
  G> if ($is_2000) { $year = "20" . "$year"; }
  G> if ($year<100) { $year = "19" . "$year"; }

  G> $date = "$months[$mon] $mday $year";
  G> ####CODE END######

why don't you just read the docs and do what they say:

	$year += 1900 ;

does all your code does with much less effort and confusion

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Mon, 5 Apr 1999 15:30:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Premature end of script headers
Message-Id: <MPG.1172d96257bd8e7d989837@nntp.hpl.hp.com>

In article <370925F1.6BFF461C@mail.cor.epa.gov> on Mon, 05 Apr 1999 
14:06:57 -0700, David L. Cassell <cassell@mail.cor.epa.gov> says...
 ...
> ...  BTW, you might be interested that Perl is traditionally
> spelled with one cap and three lowercased letters.. even though it
> is an acronym.  That was done on purpose to warn the unwary.  :-)

Can you point to a use of P[eE][rR][lL] as an acronym in any of the 
official Perl docs?  I know it isn't in perlfaq1.

What some authors may have printed on book jackets or introductions 
doesn't count.

If Perl were an acronym, it would be spelled with all caps.  (I know 
that some acronyms, such as BASIC and COBOL, existed; but as they have 
become more widely known, they have downcased into normal usage to 
divert attention from the acronymic origins.  Unix was spelled UNIX for 
trademark purposes, but was never an acronym.)
  
-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 05 Apr 1999 15:56:31 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Premature end of script headers
Message-Id: <m1zp4mad7k.fsf@halfdome.holdit.com>

>>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:

Larry> Can you point to a use of P[eE][rR][lL] as an acronym in any of the 
Larry> official Perl docs?  I know it isn't in perlfaq1.

You're gonna scream when you see how easy it is to answer you!

    perldoc perl =>

    NAME
	   perl - Practical Extraction and Report Language
    [...]
	   Perl actually stands for Pathologically Eclectic Rubbish
	   Lister, but don't tell anyone I said that.

#line 1 "Just another Perl hacker,"
print __FILE__

-- 
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: Mon, 05 Apr 1999 22:13:48 GMT
From: anna@water.ca.gov
Subject: Q: Error: No child processes
Message-Id: <7ebcil$gu8$1@nnrp1.dejanews.com>

Can you help with this error?  Prior to last week, our script worked.  Now, it
throws an error, although it still seems to work.

The script determines whether a file exists and prints it by calling lp.

Here's the snippet of code:
--------------------------

  system "/usr/bin/lp -d$dest $fullfile > /dev/null 2>&1";  if ($?) {  print
"<h1>? ! ?</h1> The print command returned an error number $?. This may be
the problem: $!<br>\n";  print "Print command: /usr/bin/lp -d$dest
$fullfile<br>\n";


Here's the error output:
------------------------

? ! ?

The print command returned an error number -1. This may be the problem: No
child processes Print command: /usr/bin/lp -dhydroq1
/db2/iodir/PRECIPSUM.1999


Thanks in advance for your reply,
Anna


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 5 Apr 1999 15:48:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Question regarding databases and unwanted data build-up
Message-Id: <MPG.1172dd887a7677e298983a@nntp.hpl.hp.com>

In article <fred222-ya023580000504991714240001@news.bellatlantic.net> on 
Mon, 05 Apr 1999 17:14:24 -0400, George <fred222@mauimail.com> says...
 ...
> seek(DAT,0,0);
> print DAT "$newmemline";

Why do you put interpolating quotes around a simple variable?

 ... 
> My question is the following:  I end up with gobbledegook building up at
> the end of each database line.  Each file is just one line, with fields
> seperated by |'s.  Here is an example of the gunk:
> 
> ...[much deleted]....0.122.205|1||1ime()()()())))))))))))))))))

perldoc -f truncate

> In any case, if responses could PLEASE be cross-emailed to me at the
> following address (with the NOSPAM deleted of course), I would be most
> appreciative:
> 
> yurtle@bellatlantic.netNOSPAM

Would have, if you had provided a clean address such as 
yurtle@bellatlantic.net (oops!).  Surely you don't think your feeble 
attempt will deceive any spamming engines.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 05 Apr 1999 15:09:15 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Speed of PERL
Message-Id: <3709348B.E847CF0A@mail.cor.epa.gov>

Jay Glascoe wrote:
> Patrick Fichou wrote:
> > I wrote a script that reads 8000 lines from a text file (ASCII) and update
> > an Excel Sheet with the OLE module... But while it takes 2 minutes with
> > Excel VBA it takes 20 minutes with a perl Script !
> 
> I seriously doubt that VB is quicker than Perl, assuming
> your perl was compiled properly. Perhaps your Perl code
> uses inefficient algorithms.  Are you passing large arrays
> to and from subroutines?  Are you using references?  Are
> your regexes efficient?

In addition, the OLE methods he's using may not be the most efficient,
since he most likely had to do some translation to re-write his VB
code into Perl.  That might be the source of the difficulty.  But
who can tell without seeing code?  My version of Net::ESP isn't
working now.

Some recent benchmarks posted in the perl-win32-users listserv
suggest that [for web authoring] PerlScript is faster than VBScript.
So I would suppose that his Perl code could be improved.  The 
perl-win32-users listserv is probably the best place for him to go
for win32-specific help.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 05 Apr 1999 21:51:31 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: This proverbial "perldoc".
Message-Id: <7ebb64$l0e$1@fir.prod.itd.earthlink.net>

"Gabriel Richards" <grichard@uci.edu> wrote:
oo-  try:
oo- 
oo-  perldoc perldoc
oo-  
oo- No dice...another idea? Where is perldoc!

Where are you typing perldoc?

If on your Win32 machine, cd to the c:\perl\bin directory and try it there.

On you *nix machine, type "which perl" go to the directory it gives you and 
try it there.

It is most likely there but the directory it resides in is not in your path.



Good luck,

Bob Trieger
sowmaster@juicepigs.com

"Contrary to popular belief, man can live on Ramen Noodles alone"    



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

Date: Mon, 05 Apr 1999 15:27:11 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
To: Gabriel Richards <grichard@uci.edu>
Subject: Re: This proverbial "perldoc".
Message-Id: <370938BF.6D9810A@mail.cor.epa.gov>

[courtest e-mail sent to poster]

Gabriel Richards wrote: 
> Where is this proverbial "perldoc" program that everyone seems to think will
> answer all newbie questions?
> 
> I've got some Win32 perl distribution here on my work machine and can't find
> any "perldoc" anywhere just a bunch of hypertext docs. I typed perldoc at my
> Unix terminal (where my scripts run) and got bad command. Do I need to
> download something from somewhere?

The 'perldoc' program should have been installed with both your Unix and
Win32 installations.  The Win32 system also has the html docs included, and you
may find those more useful.  YMMV.  But you should be able to go to a command
window (in DOS or Unix or the MS-DOS Prompt box in Win32) and type
'perldoc perldoc' to have perldoc spit out some docs on itself.  If your Unix
box gives you a 'Command not found' error, then either 
(1) your sysadmin didn't install everything right; 
(2) you have a Perl old enough not to have the perldoc program; or 
(3) you have really bad karma.  :-)

perldoc is a really convenient way to look up info on the Perl functions:
perldoc -f functionname

or a question from the Perl FAQ:
perldoc -q keyword(s)
[Note that this means you don't have to know which section of the FAQ to
search, or exactly how to phrase the question, although in some cases it
may take a couple tries to hit the right keyword.]

or info on one of your installed modules:
perldoc ModuleName

It does more, too.  Take the time to find it on at least one of your
systems.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 5 Apr 1999 15:32:36 -0700
From: "Gabriel Richards" <grichard@uci.edu>
Subject: Re: This proverbial "perldoc".
Message-Id: <7ebdfo$gck@news.service.uci.edu>

> Where are you typing perldoc?
>
> If on your Win32 machine, cd to the c:\perl\bin directory and try it
there.
>
> On you *nix machine, type "which perl" go to the directory it gives you
and
> try it there.
>
 No such luck. I've scoured my win32 box and there doesn't exist any file
named perldoc. "which perl" gives /usr/bin/perl and again nothing. Oh
well...

Gabe




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

Date: Mon, 05 Apr 1999 23:13:01 GMT
From: drgreer@qtiworld.com (Darren Greer)
Subject: Trouble with Oraperl, and simple select statement
Message-Id: <37094222.269464559@news.qgraph.com>

Howdy all.  I recently install DBD-Oracle-0.60, and DBI-Oracle-1.06,
and they isntalled fine, and the test.pl file worked fine as well.  So
I wrote this VERY simple perl script to do a simple select statement.
However, when I run this program it locks up right after running
&ora_version, at least that is all I see.  At that point, it sits
there sucking a TON of cpu time.  This select statement takes less
than a 1/4 of a second to do from sqlplus, so something is messed up.
Below is my simple code.

#!/usr/bin/perl

use Oraperl;

&ora_version;

$home = $ENV{'ORACLE_HOME'};
$sid = $ENV{'ORACLE_SID'};
$userid = "login";
$passwd = "password";

$lda = &ora_login($sid,$userid,$passwd) || die $ora_errstr;

$partsearch = "select partno, partdescr from partmaster where partno =
'108755'";

$csr = &ora_open($lda, $partsearch);

&ora_bind($csr);

$test = &ora_fetch($csr) 

&ora_close($csr);

&ora_logoff($lda);

print $test;





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5304
**************************************

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