[6968] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 592 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 9 20:17:27 1997

Date: Mon, 9 Jun 97 17:00:26 -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, 9 Jun 1997     Volume: 8 Number: 592

Today's topics:
     Re: Anyone know why a VB app called from a perl script  <mark@sierra-inc.com>
     Can I user oraperl with perl 5? <augustyn@unn.unisys.com>
     Compiling Perl code possible? (Ben Neil Gerdemann)
     Re: Fast Squaring with Math::BigInt <rootbeer@teleport.com>
     Re: How to Run Adduser Function in a Perl Script??? (Ben Hockenhull)
     Re: inconsistent opendir behaviour in Perl for win32 <wm_n00@tarrcity.demon.co.uk>
     Re: Installing Modules on NT (Does Net::NNTP work on NT <Jan.Krynicky@st.mff.cuni.cz>
     Re: Introductory Comparison of Perl and Python <Jan.Krynicky@st.mff.cuni.cz>
     Re: Introductory Comparison of Perl and Python <graham.matthews@maths.anu.edu.au>
     Re: knowing each frame URL from the server side <rra@stanford.edu>
     Re: localtime(time) yelds year 97, not 1997. In all rea (Lee)
     Re: Major perl problem <sibsib@hotmail.com>
     Re: most *robust* DBD::DBI/database combination ( <1M r <Tim.Bunce@ig.co.uk>
     Re: Multiple Accepts/Sockets <rra@stanford.edu>
     Re: Parsing Comma Delemited Text DataBase <bryan@eai.com>
     Re: passwd command and perl data? <jhi@alpha.hut.fi>
     Perl front end to LDAP <mje@FILLERpass.wayne.edu>
     Re: Premature end of script header <rootbeer@teleport.com>
     Re: Print lines without new-line <sibsib@hotmail.com>
     Re: Printing Prime Numbers (Tung-chiang Yang)
     Re: Problem with IF statement, Please assist <sveerara@sveerara-ultra.cisco.com>
     Re: Redefining STDOUT twice <ameesh@megatest.com>
     Re: Regexpert's assistance required. <sibsib@hotmail.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 09 Jun 1997 15:56:45 -0400
From: mark <mark@sierra-inc.com>
To: Grant <growan@ica.net>
Subject: Re: Anyone know why a VB app called from a perl script would hang the VB app that runs fine solo?
Message-Id: <339C5FFD.5F59@sierra-inc.com>

Grant wrote:
> 
> I've created a VB app that simply fullfills my search query through a
> product's API.  When the VB app runs solo, there is no problem.  Call it
> from a perl script and it hangs.  This is with Internet Information Server
> 2 - Netscape doesn't hang the VB app but won't allow a FileLen() call to
> resolve a UNC reference to a file I need info on (again, VB app works fine
> when run on it's own).  Is there any reason that having a perl script call
> a local program would cause these side effects.  Run on Windows NT4.0 using
> perl5 (that uses PerIIS.dll for perl scripts. - I also tried it with a
> perl.exe for NT)
> 
>    Any ideas would be extremely appreciated
> 
>   Email if possible please
> 
>   Grant Rowan
>   growan@ica.net

Well..., I'm not sure if this is applicable, but I recently ran  into a
similar situation with a perl/java combonation.  Turns out that when run
by itself, the script executes as if it's executed by the owner (which
it is), but when called by the script, it executes as if it's executed
by the user (on unix machines, at least).  By changing the permissions,
it's possible to stop the crashes.

Mark


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

Date: Mon, 9 Jun 1997 15:32:39 -0400
From: "Robert Augustyn" <augustyn@unn.unisys.com>
Subject: Can I user oraperl with perl 5?
Message-Id: <5nhlo6$k0m$1@mail.pl.unisys.com>

Hi,
I wonder if anyboady did it.
All references I found say that oraperl runs under perl 4
Is that true?
Thanks in advance
robert




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

Date: 9 Jun 1997 22:51:49 GMT
From: gerdemb@rice.edu (Ben Neil Gerdemann)
Subject: Compiling Perl code possible?
Message-Id: <5ni1e5$c8o$1@joe.rice.edu>

Hello,

Is it possible to compile Perl code into some type of binary executable? 
We are writing a Perl script to automate adding new accounts to our 
system and we want the Perl script to be the login shell.

Thanks,
Ben


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

Date: Mon, 9 Jun 1997 16:36:01 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: spg1@ix.netcom.com
Subject: Re: Fast Squaring with Math::BigInt
Message-Id: <Pine.GSO.3.96.970609162503.24741A-100000@kelly.teleport.com>

On Mon, 9 Jun 1997 spg1@ix.netcom.com wrote:

> I've been playing with a mersenne prime routine (numbers of the form
> 2**p-1), using BigInt. I notice that getting the initial 2**p takes a
> long time. What's the fastest way to do this? Can I do better than the
> BigInt package's own routine? 

Maybe... And if you can, you can probably improve BigInt's method! :-)

Seriously, BigInt could probably be tuned and tweaked a bit to improve
performance. If you'll need many powers of two, you may wish to build a
table of values of 2**N, or maybe (2**(2**N)).

> Also, the Lucas-Lehmer test requires iterating on ((s**2)-2)%(2**p-1).
> Any ideas about the fastest way to do this? 

Use PDL? :-)  PDL is in the CPAN. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 09 Jun 1997 16:13:24 -0500
From: benh@pop.websteruniv.edu (Ben Hockenhull)
Subject: Re: How to Run Adduser Function in a Perl Script???
Message-Id: <benh-ya023580000906971613240001@news.starnet.net>

In article <5nacnh$kud@netnews.hinet.net>, $j,u?OE"
<swsung.bbs@cis.nctu.edu.tw> spake thusly:

> Hi,
> 
> When we run the 'adduser' function on the screen, it prompts for
> some inputs. Can we run the function in a perl script?

The quick and not-particularly-elegant way to do it is to pass all the
variables needed by adduser in one big argument.  Many adduser scripts will
function non-interactively as long as all the necessary info is passed to
adduser.  The man page for your adduser should tell you if this is the
case.

Ferinstance, 

system("/usr/sbin/adduser -g user -G "$name,$address,$phone" -H
/usr/home/$username -p $rand_passwd -s /bin/tcsh $username");

works with BSDi adduser.  

Alternatively, you can roll your own adduser fairly easily.  The hardest
part might be finding the next unused uid, and there are freely-available
snippets of code to do that for you.

Ben

-- 
Ben Hockenhull
benh@pop.websteruniv.edu


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

Date: Mon, 9 Jun 1997 22:10:00 +0100
From: Wm <wm_n00@tarrcity.demon.co.uk>
Subject: Re: inconsistent opendir behaviour in Perl for win32
Message-Id: <+sw0hAAoEHnzEw4k@tarrcity.demon.co.uk>

Sun, 8 Jun 1997 21:15:29 <5nf7dh$ea0@pandora.cs.utwente.nl>
Simon Oosthoek <s.oosthoek@student.utwente.nl> posted...

<snips below>

>In a previous article Wm <wm_n00@tarrcity.demon.co.uk> says...
>

>Hmm, I tested this _after_ I posted it (stupid, I know) and it did work 
>in a way...

And a strange way it is indeed.

>>I agree.  What I wasn't sure about was if opendir and -d were *meant* to 
>>behave differently in some circumstances.  Anyway, if Tom thinks its a
>>bug that'll do for me.
>
>I'd love to hear some arguments for that kind of behaviour ;-)

I'm still learning perl so I certainly didn't feel that I was in a 
position to start saying that it was wrong.  

But here's one argument that crossed my mind:

directories that could be tested for existence but not read (eg execute
only permission on a Unix directory for example; I can see the file and
that it is a directory but I may not have permission to open it and see
its contents) appeared to be the sort of thing that might produce
different behaviour between -d and opendir.

>>On which point you've saved me the embarrassment of having to say that I 
>>don't have perlbug and can't find any documentation that I can see from 
>>Activeware saying how I should go about reporting one.  Could you help 
>>me out by saying what the procedure, format, etc is for future 
>>reference or point me to where I might find this information.  I will
>>also ask in the Win32 mailing list. TIA.
>
>Right, perlbug seems to be "forgotten" in the winperl release...
>Anyway, I just sent the output of Tom's script to the address listed in 
>the readme file. I included a small comment that I thought it was a bug 
>and that was it.
>
>We'll see what happens.....

I'd be interested to know if you do hear anything (perhaps by e-mail if 
more appropriate).
-- 
Wm ... did you know?  My spell checker wants tarrcity to be atrocity.


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

Date: Mon, 09 Jun 1997 22:51:24 -0700
From: Jan Krynicky <Jan.Krynicky@st.mff.cuni.cz>
To: thuja@internauts.ca
Subject: Re: Installing Modules on NT (Does Net::NNTP work on NT?)
Message-Id: <339CEB5C.503C@st.mff.cuni.cz>

Michael Iles wrote:
> 
> What is the proper procedure for installing modules on NT? (I'm running
> ActiveWare's 5.003 port.) Is it enough to just copy the .pm files into
> the proper directory?
> 
> Specifically, I was hoping to get Net::NNTP running, but I get the
> following error,
> 
> d:\>perl
> use Net::NNTP;
> Can't find loadable object for module IO in @INC at d:\utils\perl5\
>     lib/IO/Handle.pm line 229
> BEGIN failed--compilation aborted at D:\utils\perl5\lib/IO/Socket.pm
>     line 112.
> BEGIN failed--compilation aborted at D:\utils\perl5\lib/Net/NNTP.pm
>     line 11.
> BEGIN failed--compilation aborted at - line 1.
> 
> I don't know anything about bootstrapping in Perl or the DynaLoader --
> can I even expect this to work on NT?
> 
> Thanks,
> Mike.

Usualy the module consists of two parts.
Perl part ...pm
and compiled (usualy from C) part ...pll
If you find only sources (.c, .h etc.), you have to compile it yourself.
There should be some makefile there, but I wish you good luck.

You have to copy the .pm file to perl\lib\...\
and the .pll to perl\lib\auto\...\modulename\

(perl\lib\Net\NNTP.pm and perl\lib\Auto\Net\NNTP\NNTP.pll)

If you get Perse exception error then, it means that you have 
noncompatible versions of Perl and the module.

1) Use Perl build 306+
2) Make sure you do not have module version for 1xx or 304.
   Other should work.

Jenda


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

Date: Mon, 09 Jun 1997 22:59:35 -0700
From: Jan Krynicky <Jan.Krynicky@st.mff.cuni.cz>
To: Richard Moss <rjm@theory.chem.ubc.ca>
Subject: Re: Introductory Comparison of Perl and Python
Message-Id: <339CED47.1967@st.mff.cuni.cz>

Richard Moss wrote:
> 
> Is there any reason, apart from C legacy (sigh), that in Python
> arrays/lists have a 0-based indexing, and not a much more rational
> (unless you know C) 1-based indexing?
> 
> thanks,
> 
> Richard

There are much moe horrible things languages inherit from that 
<censored> C.

I personaly hate most the prefix types.

   ( type variable;  )

well more like
   ( type chaos variable more_chaos; )

It looks like the genii that "invented" C, wasn't able to think
in anything else than integers. If you have a function that returnes
just simple types like int or char, everything's OK.
As soon as you start to work, you're stuck with slight difference
between

 int *f(int x);
 int (*)f(int x);
 int (*f)(int x);
 int (*f(int x)); // this one is probably incorrect.

Imagine that you'd want to make a function that would return a function.
The best would surely be

void *fce(params);

anything else is farbehind anyones posibilities.

Oh well. And we have to use it . <censored>

Jenda


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

Date: Tue, 10 Jun 1997 09:22:48 +1000
From: Graham Matthews <graham.matthews@maths.anu.edu.au>
Subject: Re: Introductory Comparison of Perl and Python
Message-Id: <339C8FFA.3398@maths.anu.edu.au>

Richard Moss wrote:
> 
> Is there any reason, apart from C legacy (sigh), that in Python
> arrays/lists have a 0-based indexing, and not a much more rational
> (unless you know C) 1-based indexing?

Personally I like 0 based indexing since it allows you to implement
"circular indices" quite straightforwardly using mod.

graham
-- 
           Got a wife and kids in Baltimore Jack
         I went out for a ride and I never went back
        Like a river that don't know where its flowing
          I took a wrong turn and I just kept going


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

Date: 09 Jun 1997 15:57:47 -0700
From: Russ Allbery <rra@stanford.edu>
To: Thamer Ashour <tashour@mars.superlink.net>
Subject: Re: knowing each frame URL from the server side
Message-Id: <m367vnxu38.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

Thamer Ashour <tashour@mars.superlink.net> writes:

>     I have a need to have a cgi or a server program to keep a tap on the
> user movement by knowing each URL he/she is on.  This is done by having
> a two frames, one frame will stay on static while the other can change
> when the user click any link inside.  The first frame will register the
> URL of the second frame when the user click on a button within the first
> frame.  This registration action will be done on the server.

This question has nothing to do with Perl.

Please post your questions to the appropriate newsgroup.  This newsgroup
is specifically for discussing Perl programming and the Perl language; it
is not for CGI scripting, general web development, frames, HTML, web
specifications, or anything else along those lines.  There is a
comprehensive WWW hierarchy that is full of groups for those topics;
please use it so that those people who wish to read about web programming
and development can do so and those who don't can avoid it.

Try one of the following:

        comp.infosystems.www.advocacy
        comp.infosystems.www.announce
        comp.infosystems.www.authoring.cgi
        comp.infosystems.www.authoring.html
        comp.infosystems.www.authoring.images
        comp.infosystems.www.authoring.misc
        comp.infosystems.www.authoring.site-design
        comp.infosystems.www.authoring.stylesheets
        comp.infosystems.www.authoring.tools
        comp.infosystems.www.browsers.mac
        comp.infosystems.www.browsers.misc
        comp.infosystems.www.browsers.ms-windows
        comp.infosystems.www.browsers.x
        comp.infosystems.www.misc
        comp.infosystems.www.servers.mac
        comp.infosystems.www.servers.misc
        comp.infosystems.www.servers.ms-windows
        comp.infosystems.www.servers.unix

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 09 Jun 1997 18:26:44 GMT
From: DeathToSpam@dev.null.com (Lee)
Subject: Re: localtime(time) yelds year 97, not 1997. In all realizations?
Message-Id: <339c4a98.1431442@news.earthlink.net>

Perl doesn't have a 2000 type problem until 2037...at least at this
point, but I would count on the high priests of Perl to come up with a
solution by then.

--Lee
lee@designwest.com


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

Date: Mon, 09 Jun 1997 18:41:07 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: Major perl problem
Message-Id: <339C8683.613028CF@hotmail.com>

Negative Creep wrote:

Hmm.  Really makes one want to help, doesn't it?

>  There are no error messages it redirects and everything.  Perl should give
> an error if it can't write to a file.  Here is the script, I've spent 
Perl does, if you give it a chance.  Have you tested the script 
from the command line?

> open(FILE,">>/mnt/web/guide/mav/nc/dvdepot/emails.txt");

You forgot to put 
    or die "could not open emails.txt: $!" here ---------^

> close(FILE);

And a similar bit of code on this line, in case your disk 
was full.

Scott

-- 
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net


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

Date: Mon, 9 Jun 1997 21:12:07 GMT
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Re: most *robust* DBD::DBI/database combination ( <1M records ) ??
Message-Id: <EBJ1K8.Bz3@ig.co.uk>
Keywords: perl,database,DBD,DBI,cgi,www

In article <slrn5p7mp3.jj.amore@teleport.com>,
Linux_User <amore@teleport.com> wrote:
> 
> After having scanned some www urls, I wonder which combination 
> of DBI and database is the most stable and robust? Which has 
> been the most time tested (esp. for www work) ?? 
> 
> Some of these modules/combinations seem as unstable as many MS
> products. Alphas, betas, etc. Help a newbie perl chap out :-)
> 
> Any suggestions, or reference articles?

I guess as the developer of the DBI and DBD::Oracle modules I can say
that they are being used in some very large and critical applications.

One in particular that I've been working on recently for a very large
company processes millions of records per day in a very critical and
high profile application.

Oracle are now shipping the DBI and DBD::Oracle modules with their web
server 3 product.

Tim.



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

Date: 09 Jun 1997 15:50:48 -0700
From: Russ Allbery <rra@stanford.edu>
To: kessler@dfacades.com
Subject: Re: Multiple Accepts/Sockets
Message-Id: <m3afkzxuev.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

kessler <kessler@dfacades.com> writes:

> In the Camel example, the server doesn't fork until an accept returns;
> but this way, your children are spawned to handle one connection and
> then expected to exit.  I'd like them to stay around and handle more
> connections, so that a surge in access is quickly dealt with.

> Apache can do it in C... can I do it in perl?

Yes, but you'd have to do it the same way that Apache does it; with file
descriptor passing.  The main server has to call accept() for each
incoming connection; it then passes that file descriptor to the children.
File descriptor passing is not particularly trivial; you'll probably want
a good book on how to do it to use as reference unless you want to figure
it out from the Apache source.  Stevens, _UNIX Programming_ is considered
to be the canonical reference for such things.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 09 Jun 1997 17:29:55 -0500
From: Bryan Hart <bryan@eai.com>
Subject: Re: Parsing Comma Delemited Text DataBase
Message-Id: <339C83E3.59E2@eai.com>

Larry D'Anna wrote:
> 
> David Keeney wrote:
> >
> > On Sun, 08 Jun 1997 10:57:19 -0400, Nasser Al-Zawawi
> > <nzawawi@worldnet.att.net> wrote:
> >
> > >I trying to figure out how to parse a Text DataBase that is Comma
> > >delimeted and has "" Double quotes for its strings fields.  My problem
> > >is withen these string fields you could have a comma that should not be
> > >parsed.
> > >Meaning
> > >1,"Hello, World",6,"hi"
> > >Should be parsed into 4 fields
> > >1. 1
> > >2. "Hello, World"
> > >3. 6
> > >4. "hi"
> > >
> > >Not 5 fields
> > >1. 1
> > >2. "hello
> > >3. World"
> > >4. 6
> > >5. "hi"
> > >
> >
> > Maybe:  m/(.+?),(".+?"),(.+?),(".+?")/;
> >
> > This would put the fields, as you listed them, into predefined
> > variables $1, $2, $3, $4.
> >
> > If one or more of the fields may be 0 length, try .*? instead of .+?
> > in the same expression above.
> 
> I'm shure this is probably a really stupid question, but why are you
> useing .+? instead of just .+   ?  I thought you could only use one
> multiplier after a charicter.
> 
> --
> Larry D'Anna

Adding a ? makes the match non-greedy, so .+? is the non-greedy version
of .+ (it matches the minimum, instead of the maximum).

For example:

$str = "foobar foobar";
$temp1 = $str;
$temp2 = $str;
$temp1 =~ /foo.*bar/;
$temp2 =~ /foo.*?bar/;

$temp1 is "foobar foobar"
$temp2 is "foobar"

Bryan

-- 
-------------------------------
|  Bryan Hart                 
|  Network Products Engineer  
|  Engineering Animation Inc. 
|  Phone: (515) 296-5979
|  Fax: (515) 296-7025
|  Email: bryan@eai.com              
|  Web: http://www.eai.com/                          
-------------------------------
"A conclusion is simply the place where you got tired of thinking"


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

Date: 09 Jun 1997 21:01:41 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: passwd command and perl data?
Message-Id: <oeesoyrvenu.fsf@alpha.hut.fi>


Bryan Hart <bryan@eai.com> writes:

: Eric Harley wrote:
: > How would I pipe data into the passwd(1) command on a BSD box?
: > Do i just open it like a file handle?
: > open PAS, "| passwd $user";
: > print PAS "$oldpass";
: > print PAS "$newpass";
: > print PAS "$secondpass";
: > Thanks!
: > -Eric Harley
: > erich@powerwareintl.com
: Close, try:
: open PAS, "| passwd $user";
: print PAS "$oldpass\n";
: print PAS "$newpass\n";
: print PAS "$secondpass\n";
: close PAS;
: or
: open PAS, "| passwd $user";
: print PAS <<EOM;
: $oldpass
: $newpass
: $secondpass
: EOM
: close PAS;
: 
: Depending on how buffering is handled, it might not work correctly w/o
: the close().

Sorry, won't work.  passwd(1) does not read its input from stdin,
therefore piping won't work.  passwd(1) opens a direct connection
to the terminal line (it opens the device "/dev/tty" which for each
process signifies the terminal line).  This is done for security
reasons.

This cannot be done with Perl but you could try the Expect package by
Don Libes, please see <URL:http://expect.nist.gov/>.  Expect requires
Tcl because it is a Tcl extension.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Mon, 09 Jun 1997 16:08:16 -0400
From: Michael Edelman <mje@FILLERpass.wayne.edu>
Subject: Perl front end to LDAP
Message-Id: <339C62B0.656C@FILLERpass.wayne.edu>

Is anyone using PERL to call LDAP routines? I'm a newbie to both Perl
and LDAP, and I'm having a hard time calling the ldapmodify routine from
Perl using system.

-- mike
 -----------------------------------------------------------------------
 Michael Edelman                        mje@pass.wayne.edu
 Wayne State University                 voice: (313) 577-0742
 Computing & Information Technology     fax:   (313) 577-8787
 Academic Computing & Support Services 
 Detroit MI 48070     http://www.pass.wayne.edu/~mje/home.html 

(Remove the FILLER from my return address when mailing)


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

Date: Mon, 9 Jun 1997 12:54:31 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "C.W. Chiu" <cwchiu@postprint.nl>
Subject: Re: Premature end of script header
Message-Id: <Pine.GSO.3.96.970609125325.5349B-100000@kelly.teleport.com>

On 9 Jun 1997, C.W. Chiu wrote:

> Subject: Premature end of script header

> If the script is running from the command line it works well
> if i call it from my browser i get this message in my error_log file

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!

   http://www.perl.com/perl/
   http://www.perl.com/perl/faq/
   http://www.perl.com/perl/faq/idiots-guide.html

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Mon, 09 Jun 1997 18:45:31 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: Print lines without new-line
Message-Id: <339C878B.23713D47@hotmail.com>

Brian A. Duncan wrote:
> Here's a short example of what I want to do:
> 
> print "This is text...";
> for $arg (@args) {
>         print "more text...";
> }
> 
> I want this output: "This is text...more text...more text..." etc...

That's exactly the output I got when I ran your code (after
defining @args, of course).

Perhaps you're having a problem with buffering?  Take a look 
at the '$|' special variable (which is also known as 
'$output_AUTOFLUSH'.

Scott

-- 
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net


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

Date: Mon, 9 Jun 1997 18:38:13 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Printing Prime Numbers
Message-Id: <tcyangEBIuFp.5nG@netcom.com>

I really suggest we start crossposting this thread to sci.math :)

--
Tung-chiang Yang                       tcyang@netcom.com

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: 09 Jun 1997 11:23:58 -0700
From: Sriranga Veeraraghavan <sveerara@sveerara-ultra.cisco.com>
Subject: Re: Problem with IF statement, Please assist
Message-Id: <ls367vnbpoh.fsf@sveerara-ultra.cisco.com>

rkl@flexsol.co.nz (rk) writes:

[snip]

>  open(DATAFILE, "$data_file_path") ||
>     &file_open_error("$data_file_path",
>     "Read Database",__FILE__,__LINE__);
>     while(($line = <DATAFILE>)) 
>     {
>      unless ($line =~ /^COMMENT:/)
>       {
>         chop($line); # Chop off extraneous newline
>         @fields = split(/\|/, $line);
>       }
>          $temp = @fields[0];
		   ^^^^^^^
		   I think you want $fields[0], not @fields[0]

>          if ($temp eq "plexus")
>           {
>             @founduser = @fields;
>           }
>     }
>   close (DATAFILE);       
>   $phone = @founduser[4];
	     ^^^^^^^^^^
	     Same here, $founduser[4]

>   $zip =   @founduser[0]; #$temp;
	     ^^^^^^^^^^
	     And here, $founduser[0], though you could just use temp

>   &edit_profile;
>   &search_results_footer;
>   }


HTH,

     ----ranga <sveerara@cisco.com>


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

Date: Mon, 09 Jun 1997 12:08:26 -0700
From: Ameesh Oza <ameesh@megatest.com>
Subject: Re: Redefining STDOUT twice
Message-Id: <339C54AA.5971@megatest.com>

Chipmunk wrote:
> 
> In article <33985E5F.71FD@megatest.com>
> Ameesh Oza <ameesh@megatest.com> writes:
> 
> > I would like to
> >
> > open (STDOUT , "> $LOGFILE");
> >
> > ...do my thing where all standard out does to $LOGFILE...
> >
> > close (STDOUT);
> >
> > #want next print to go to screen but do not know how to
> > #redefine STDOUT after the close statement above
> >
> > print "program completed sucessfully...";
> 
> I don't know why you want to redefine STDOUT, instead of using a
> different name for your filehandle, but you can open STDOUT like so:
> 
> open(STDOUT, ">-") || die "Unable to open stdout: $!";
> 
> Chipmunk
This did not work for me in Perl 5.003 on Solaris. No warning
or error was issued. Output still went to $LOGFILE after
this redefinition.
The following from  aml@world.std.com (Andrew M. Langmead)


snip... 

open SAVEOUT, '>&STDOUT' or die "Can't dup STDOUT\n";
open STDOUT, ">$LOGFILE" or die;
print "this goes to $LOGFILE\n";
open STDOUT, '>&SAVEOUT' or die "Can't re-dup STDOUT\n";
print "program completed sucessfully...\n";

 ...

works fine.

The reason I want to redifne STDOUT is to redirect any
output and error from system calls that I am making to
the log file. The Perl script is running as a cron job
and I need a record of the output from the system calls.

ameesh


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

Date: Mon, 09 Jun 1997 18:35:24 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: Regexpert's assistance required.
Message-Id: <339C852C.E3DE9ED0@hotmail.com>

Simon Fairey wrote:
>         item1, function1([0,11], function2() ), item2
> 
> What I want is to just extract the three entries
>         item1
>         function1([0,11], function2() )
>         item2

If you know that your 'item1' and 'item2' won't have commas
in them, then just use

         index
         rindex
         substr

to pick apart your string.

Scott

-- 
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net


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

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

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