[6960] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 585 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 7 11:07:27 1997

Date: Sat, 7 Jun 97 08:00:24 -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           Sat, 7 Jun 1997     Volume: 8 Number: 585

Today's topics:
     Re: Count lines in file:which is fastest? (Tad McClellan)
     help!!! OLE with  perl & excel problem <sanyi@hercules.chem.wvu.edu>
     How can I look for a case insensetive name?.. <perlprogrammer@hotmail.com>
     Re: How can I look for a case insensetive name?.. (A. Deckers)
     Re: How can I set up this server to run perl faster?... (Scott M. Hinnrichs)
     Re: How to Run Adduser Function in a Perl Script??? (Chipmunk)
     Re: Mass emailing <andrew@squiz.co.nz>
     Re: Open and print HTML file insside CGI script (Abigail)
     Re: Printing Prime Numbers (Bill Totten)
     Re: Printing Prime Numbers (Abigail)
     Re: Printing Prime Numbers <ajohnson@gpu.srv.ualberta.ca>
     Problem compiling OraPerl -- update -- (Zoran Cvetkovic)
     Re: question about behavior of $& <ajohnson@gpu.srv.ualberta.ca>
     Re: Redefining STDOUT twice (Tad McClellan)
     Re: Redefining STDOUT twice (Chipmunk)
     Re: Rounding off numbers <bwilcox@shianet.org>
     Re: Standalone web database for Perl? (Peter J. Schoenster)
     Windows 3.1 / Perl 4 or 5 (Zac)
     Windows 3.1 / Perl 4 or 5 (Zac)
     Windows 3.1 / Perl 4 or 5 (Zac)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 7 Jun 1997 00:14:39 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Count lines in file:which is fastest?
Message-Id: <vnqan5.q8g.ln@localhost>

P.M.Wong (s11976@ctsc.hkbc.hk) wrote:
: I've found that there are quite a few ways to get the no  of lines
: in a text file, such as:

[ snip ways that read the entire file ]

:  Say my file is fairly long, (though each line is just one 8char. field)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You are changing the rules. Now you can *calculate* the number of lines,
given the file size. 

If you have variable length lines, then all you can do is read the
whole file anyway, as the above do.


:  , i 'm interested to know which of the above evaluates no. of lines
:  fastest?

None, given this new and different question ;-)


print "there are ", (-s "filename") / 8, " lines in the file\n";



:  BTW, for method 1, how does the parameter 4096 depends on (i.e. any formula
:  to calculate the best no. ) the no. of bytes in  my file so that
:  i could get the fastest  response back?


The disk block size, or some multiple of it.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Thu, 05 Jun 1997 20:20:30 -0400
From: Sandor Kadar <sanyi@hercules.chem.wvu.edu>
Subject: help!!! OLE with  perl & excel problem
Message-Id: <339757CE.C2EE85D7@hercules.chem.wvu.edu>

hi guys,

any idea why the following segment wouldn't open the password protected
workbook:

$application = CreateObject OLE 'Excel.Application' || die $!;
$workbook =
$application->Workbooks->Open("f:\\test\\excel\\password.XLS",,,,"pwd","pwd");

if i try

$workbook =
$application->Workbooks->Open("f:\\test\\excel\\password.XLS");

it asks for the passwords as it should and opens the workbook. if i
remove the passwords from the workbook, the script opens it without any
problem.
in visual basic the
Workbooks.Open("F:\myfile.xls")
works but if one adds one more parameter like

Workbooks.Open("F:\myfile.xls",,,,"password","password")

it gives compile error. however,

Set myApp = Workbooks.Open("F:\myfile.xls",,,,"password","password")

works! any idea how i can implement this in my perl script???

thanks,

sandor



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

Date: Sat, 07 Jun 1997 02:30:13 -0700
From: perl guy <perlprogrammer@hotmail.com>
Subject: How can I look for a case insensetive name?..
Message-Id: <33992A25.2E6F@hotmail.com>

does anyone know how I can search case insensitively?.. for example, I
have it search out and match now, but only the exact case!.. for
example, right now, I have it open the room directories in a chat forum,
it searches all the rooms, to see if that name is in use, if it *is*,
then is tried and match the password, if the name doesn't match the
password, then it calls the Room Full sub, but if it does match the
password and name, then it's the same person, and they can get back in.
(these are only temp people files, because people time out or leave)..
then someoen else can use that name with whatever password. Anyway, it
works great, other then the fact that it doesn't say that the name is in
use if someone types in a different CaSe HaNdLe, and they can see other
people's private messages then.. I could make it send the private
messages to the person's name and shadowed password, but it's easier
this way.. I just don't know how to do this..  anyway, here's what's
going on.. it opens and searches the files...

opendir(PEOPLEFILE, "$the_room_list");
   @files = grep (/people$/, readdir (PEOEPLEFILE));
   closedir (PEOPLEFILE);
   if (@files > 0)
      {
      foreach $peoplefile (@files)
         {
         open (PEOPLEFILE, "$the_room_list/$peoplefile");
         $people = <PEOPLEFILE>;
         @peoplefields = split (/\|/, $people);
         close (PEOPLEFILE);

## Then here is where is searched the name to see if it matches the
password in the files.. for example, the "peoplefile" has "people
fields", as in |user number|name|home page|email address|password|IP
address|time|etc... let's say that the name is [0], and the password is
[2]... 
         
           if ($name eq $peoplefields[0] && $pass ne $peoplefields[2])
            {
            &NameInUse;
            exit(0);
            }

Ok. this works great, but how can I do this to search for the name and
password combination to see if it's already in use by someone else, even
if it's typed in a different CaSe!??.. any ideas?. I've tried all the
ways I know.. it didn't work..


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

Date: 7 Jun 1997 10:38:18 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: How can I look for a case insensetive name?..
Message-Id: <slrn5piegq.a4f.I-hate-cyber-promo@news.rediris.es>

In <33992A25.2E6F@hotmail.com>,
	perl guy <perlprogrammer@hotmail.com> wrote:
>Newsgroups: comp.lang.perl.misc,comp.lang.perl

comp.lang.perl is a bogus group. Please don't post there. I've removed
it from the newsgroups header.

>Subject: Re: How can I look for a case insensetive name?..
>does anyone know how I can search case insensitively?.. for example, I
[much ranting deleted]

if ($foo =~ /some_pattern/i) {  # The /i flag makes the
                                # match case INsensitive.
	# do something
} else {
	# do something else
}

In your case, you probably want to anchor your pattern at the front and
at the end:

if ($foo =~ /^some_pattern$/i) {
	# do something
} else {
	# do something else
}

You should look at the perlre manual page.

HTH,

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
        Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>


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

Date: Sat, 07 Jun 1997 07:20:47 -0700
From: smh@netserv.com (Scott M. Hinnrichs)
Subject: Re: How can I set up this server to run perl faster?...
Message-Id: <smh-0706970720470001@smh-ppc.netserv.com>

In article <5n9f0i$dl5$1@nntp.Stanford.EDU>, dhinds@hyper.stanford.edu
(David Hinds) wrote:

>Scott M. Hinnrichs (smh@netserv.com) wrote:
>
>: I don't know why I haven't seen this idea posted before.  It seemed pretty
>: obvious to me.  Anyway...
>
>: I first ran into this for a medical library site, they had one swap
>: partition, and the access time for that partition was *really* long.  Even
>: though they had 512MB of memory they still had slow CGI performance.
>
>: The problem is that everytime a bin runs it creates an entry in swap,
>: whether it ever uses it or not.
>
>This might have once been true, but it is not true of any modern Unix
>implementation that I'm aware of.  Certainly not true of Linux, IRIX,
>DEC Unix, Solaris.  Even if the OS preallocates swap space for a
>process, this doesn't require any IO: it just marks some amount of
>space as reserved in a kernel data structure.  The preallocation is
>also not explicitly of swap space: it is a preallocation of virtual
>memory, as the sum of memory + swap, so you've got to do it whether
>you've actually got any swap space or not.
>
>If you have enough memory so that there is never a need to swap, I
>guess it is still conceivable that for some system loads, it might be
>better to turn swap off completely, but I would be very surprised if
>the effect is ever large.  And if you ever do run short on memory in
>this configuration, your performance will truly suck.  If just adding
>swap space (without any actual swapping) slows the system down, that's
>a bug.  It is not a common attribute of Unix systems in general.

I guess I should have mentioned the medical library site was a SS1000
running Solaris 2.4 (it might have been 2.5, been a few months and it was
a quick fix). 

Performance was indeed held back by the single swap disk, and turning off
swap immediately improved response.  It was peak load of the day, and it
was clear to all that the change made the server useable, and stopped
timeouts.  Several days of followups asking the admins brought smiles, and
no complaints.

Give it a try on your system, if it doesn't work move on to the next fix :)

Good luck, Scott


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

Date: 7 Jun 1997 04:59:01 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: How to Run Adduser Function in a Perl Script???
Message-Id: <5napql$rk0$1@dartvax.dartmouth.edu>

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

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

I'd guess you need to open a pipe to adduser.

open(ADDUSER, "| adduser") || die "Unable to execute adduser: $!";
print ADDUSER "input\n";
close ADDUSER;

Something like that, perhaps.

Chipmunk


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

Date: Sat, 07 Jun 1997 19:00:18 +1200
From: "Andrew McNaughton" <andrew@squiz.co.nz>
Subject: Re: Mass emailing
Message-Id: <andrew-0706971900180001@banjo.actrix.gen.nz>

In article <338DAB58.41C67EA6@wwisp.com>, Steve Buchanan <steveb@wwisp.com>
wrote:

>Here is a piece of code I use all the time for exactly that.  List all
>of your email addresses in a file, one per line.  Then run the
>following:
>
>#!/usr/bin/perl
>
>$count = 0;
>open (in, '/path/to/address/list.txt');
>while(<in>){
>        foreach $_ (split (/[ \t\n]+/))
>        {$name = $_;}
>$count ++;
>if ($count == 20)
>{
>$count = 0;
>sleep 2;
>}
>
>#system ("mail $name  < /path/to/file/you/you/want/to/send");
>
>}
>close in;

Mailing addresses commonly have characters in them which will be interpreted
by the shell.  eg. <,>,;

Supposing someone suspected code like this and gave you a email address with
a command sandwiched between semicolons.



Does anyone have something which will identify what is and is not a
standards compliant mail address?

Andrew McNaughton




Check out the newsroom:  http://www.newsroom.co.nz
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
Andrew McNaughton         |       I tried to make it idiot proof,
Andrew@squiz.co.nz        |       but they just developed a  
http://www.squiz.co.nz    |       better idiot

 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .


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

Date: Sat, 7 Jun 1997 09:22:53 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Open and print HTML file insside CGI script
Message-Id: <EBEFE5.41u@nonexistent.com>

Andrew McNaughton (andrew@squiz.co.nz) wrote on 1376 September 1993 in
<URL: news:andrew-0706971855010001@banjo.actrix.gen.nz>:
++ In article <338d9825.1132556@saluki-news.siu.edu>, ddutta@siu.edu (Deepak
++ Dutta) wrote:
++ 
++ >for each $filein (@filein) {
++ >  print $filein;
++ >}
++ 
++ foreach (@filein) {print};

print @filein;



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: 7 Jun 1997 03:32:32 -0400
From: biell@copland.udel.edu (Bill Totten)
Subject: Re: Printing Prime Numbers
Message-Id: <5nb2qg$3jd$1@copland.udel.edu>

In article <5n9ro3$csm$1@marina.cinenet.net>,
Craig Berry <cberry@cinenet.net> wrote:
 <...>
>Actually, 1 is not considered a prime, for reasons I've never entirely 
>understood.  But my friend the math genius assures me it's true. :)
 <...>

  Aren't Prime numbers defined as all numbers such that 
each number is prime iff it is evenly divisable by exactly 2 numbers,
namely 1 and itself?
  By this definition, 1 is not prime since it is only evenly divisible by one
number, itself.
-- 
Totten, William David (Bill)         Computer and Information Science Major
totten@pobox.com                   University of Delaware (Newark, DE; USA)
http://pobox.com/~totten/               Friends don't let friends use emacs


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

Date: Sat, 7 Jun 1997 07:50:51 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Printing Prime Numbers
Message-Id: <EBEB4r.Jn7@nonexistent.com>

Craig Berry (cberry@cinenet.net) wrote on 1375 September 1993 in
<URL: news:5n9ro3$csm$1@marina.cinenet.net>:
++ Darryl Caldwell (darrylc@eznet.com) wrote:
++ : A friend told me about a software test he had to do at a job interview.
++ : He was told "print out all the prime numbers between 1 and 50." Coming
++ : from a liberal arts background, I had to first find out what a prime
++ : number _is_, then I set to working it out in Perl.
++ : 
++ : The result is below. Essential it first prints out 1 since we know that
++ : it a prime number,
++ 
++ Actually, 1 is not considered a prime, for reasons I've never entirely 
++ understood.  But my friend the math genius assures me it's true. :)

A prime number is a natural number with exactly two dividers
(in the natural numbers). What's so difficult about the concept
that 1 != 2?


One of the simplest (and one of the fastest methods) is the
sieve of Eratosthenes. Known for eons. (23 centuries [0])


Here's an implementation:

#!/usr/local/bin/perl -wl
use strict;
 
my ($prime, $max) = (2, shift || 50);          # First prime, max number.
my @sieve = (0, 0, map {1;} ($prime .. $max)); # Init sieve.
 
while ((my $product = $prime * $prime) <= $max) {
    do {$sieve [$product] = 0;} while (($product += $prime) <= $max);
    do {$prime ++;}             while !$sieve [$prime];
}
 
map {print if $sieve [$_];} (0 .. $max);
__END__


[0] http://www.utexas.edu/depts/grg/ustudent/frontiers/fall95/morrison/morrison.html


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: Fri, 06 Jun 1997 14:34:40 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Printing Prime Numbers
Message-Id: <33986650.4FB90E90@gpu.srv.ualberta.ca>

Darryl Caldwell wrote:
! 
! A friend told me about a software test he had to do at a job interview.
! He was told "print out all the prime numbers between 1 and 50." Coming
! from a liberal arts background, I had to first find out what a prime
! number _is_, then I set to working it out in Perl.
! 
! The result is below. Essential it first prints out 1 since we know that
! it a prime number, then it discards even numbers. Next, it runs a series
! of tests on the remain odd numbers. If the variable $b holds a decimal
! number, it skips to the next TRY test, if it holds a whole number other
! than 1, it stops the TRY test and begins the whole series again with the
! next number from the initial range.

[snip]

a good number of mathematical definitions say that an
integer a is prime if: a>1 and has only the trival divisors
of a and 1. So your inclusion of 1, though common, is not
generally considered correct---and you've forgotten 2 as
a prime number.

regards
andrew


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

Date: 6 Jun 1997 22:24:38 GMT
From: zcvetkov@gpu1.srv.ualberta.ca (Zoran Cvetkovic)
Subject: Problem compiling OraPerl -- update --
Message-Id: <5na2n6$hfs$1@pulp.ucs.ualberta.ca>


Well, the updated question is as follows:

the original problem of compilation crash still exists, even though the ORACLE GUYS said that the two *.z files that were "missing" were actually renamed in ORACLE 7.3 and go as follows...

7.2			7.3
================================
libora.a	--> libserver.a
libocic.a	--> libclient.a

Trying to compile still gives me the same problem....
and plus... it cannot find the libsqlnet.a in the directory in which it actually exists. Odd.
i
Maybe I should include the relevant part of the MAkefile for oraperl too:
 - - - - - - -

# Makefile for Oraperl and Coraperl                                             
                                                                                
# Change these to your ORACLE installation directory and Perl source directory  
#                                                                               
ORACLE_HOME     = /u01/app/oracle/product/7.3.2                                 
SRC             = /usr/local/bin/perl-4.036                                     
CC=cc                                                                           
                                                                                
# Oracle Definitions, copied from $(ORACLE_HOME)/c/demo/proc.mk                 
# ALL_ORA_LIBS is the only entry that the Makefile actually uses;               
# change it to whatever you need to link Pro*C programs                         
#                                                                               
OTHERLIBS       = -lcl -lm                                                      
CLIBS           = $(OTHERLIBS)                                                  
OCILIB          = $(ORACLE_HOME)/lib/libclient.a                                
NETLIBS         = $(ORACLE_HOME)/lib/osntab.o \                                 
                        $(ORACLE_HOME)/lib/libsqlnet.a                          
ORALIBS         = $(ORACLE_HOME)/lib/libserver.a  \                             
                  $(ORACLE_HOME)/lib/libpls.a \                                 
                  -L$(ORACLE_HOME)/lib -lnlsrtl -lcv6 -lcore -lnlsrtl -lcv6 -lco
re                                                                              
                                                                                
ALL_ORA_LIBS    = $(CLIBS) $(OCILIB) $(NETLIBS) $(ORALIBS)                      
                                                                                
# Perl Definitions, taken from $SRC/usub/Makefile                               
# Don't include the curses libraries here - they go in CURSELIB                 
#                                                                               
GLOBINCS        =                                                               
LOCINCS         =                                                               
LIBS            = -lcurses -ltermlib `. $(SRC)/config.sh; echo $$libs`          
                                                                                ...

# From here on, you shouldn't need to change anything. If you do, let me know.  
                                                                                
SRCS            = oracle.mus orafns.c getcursor.c colons.c usersub.c \          
                  debug.c strtoul.c                                             
OBJS            = oracle.o orafns.o getcursor.o colons.o debug.o $(STRTOUL)     
OOBJS           = $(OBJS) usersub.o $(DBUG_O)                                   
COBJS           = $(OBJS) cusersub.o $(DBUG_O)                                  
HDRS            = patchlevel.h orafns.h                                         
DEFS            = $(STRTOL) $(PUTENV) $(STR_2MORTAL) $(DEBUG) $(CACHE) $(BIND)  
LDFLAGS= -g                                                                     
CFLAGS          = -g -Idbug -I$(SRC) $(GLOBINCS) $(LOCINCS) $(DEFS)             
                                                                                
oraperl: $(SRC)/uperl.o $(OOBJS)                                                
        $(CC) $(LDFLAGS) -o oraperl $(SRC)/uperl.o $(OOBJS)                     
\                                                                               
              -lm $(ALL_ORA_LIBS) $(LIBS)                                       
                                                                                
coraperl: $(SRC)/uperl.o $(COBJS) $(SRC)/usub/curses.o                          
        $(CC) -o coraperl $(SRC)/uperl.o $(COBJS) $(SRC)/usub/curses.o  \       
              -lm $(ALL_ORA_LIBS) $(LIBS) $(CURSELIB)                           
                                                                                
all:    oraperl coraperl                                                        
                                                                                
test:   oraperl                                                                 
        @oraperl -e '&ora_version'                                              
        @(cd testdir ;                                                        \ 
          rm -f My-Results ;                                                  \ 
          echo "Testing oraperl, please wait ..." ;                           \ 
          for i in *.pl ; do ../oraperl $$i $(TESTDATA) ; done > My-Results ; \ 
          if cmp -s Standard-Results My-Results ;                             \ 
          then echo "Test successful" ;                                       \ 
          else echo "Test failed - compare My-Results with Standard-Results" ;\ 
          fi; echo)                                                             
                                                                                 - - - - - - - - -

So, there.
If anyone has a clue as to what is going on, or if there is any oother suggestions, I would gladly appreciate them.

Zoran.


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

Date: Fri, 06 Jun 1997 12:21:42 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: question about behavior of $&
Message-Id: <33984726.6360BA86@gpu.srv.ualberta.ca>

ekoontz@acsu.buffalo.edu wrote:
! 
! The following program :
! -----------------------
! #!/usr/local/bin/perl
! 
! $string1 = "hello";
! $_ = $string1;
! /hello/;
! print "\$& contains $&\n";
! /goodbye/;
! print "\$& still contains $&\n";
! ------------------------
! produces the output :
! 
! $& contains hello
! $& still contains hello
! 
! According to the camel book, "$& returns the entire matched string",
! p(105)
! but it seems that what is actually going in is that
! $& returns the last *SUCCESSFULLY* matched string.

$& returns the entire matched string---and should continue
to do so until another *match* happens, whereupon $& will
return the entire matched string :-)

! Anyone know how to "clear" $& so that we can test for failed matches
by
! doing :
! 
! if (!$&) {
!         print "the regexp matching failed!";
! }

you can simply do a statement on failure as in:

$string="this doesn't have what we want";
print "regex failed!\n" if $string!~/blah/;

or perhaps you only want to print on success:
print "regex matched\n" if $string=~/blah/;
(which won't print in this case)

or a conditional block:

if ($string=~/$pattern/) {
   #do success stuff here
} else {
   #do failure stuff here
   #$& holds last actual match though!
}

BTW, you might not want to use $& if you can help it...it
invokes a performance penalty on all regexes for the entire
script---wrap your pattern in parentheses and use $1 or
something.

hope it helps
regards
andrew


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

Date: Sat, 7 Jun 1997 00:03:29 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Redefining STDOUT twice
Message-Id: <13qan5.r6g.ln@localhost>

Ameesh Oza (ameesh@megatest.com) wrote:
: I would like to

: open (STDOUT , "> $LOGFILE");

: ....do my thing where all standard out does to $LOGFILE...


Why not use some other filehandle and the 'select' statement?

------------------------
#! /usr/bin/perl -w

$logfile = 'log.file';

open(MYOUT , "> $logfile"); # I cannot bring myself to use an upper
                            # case variable name...

select MYOUT;
print "Hello My World!\n";

select STDOUT;
print "Hello Std World!\n";
------------------------



--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 7 Jun 1997 05:00:17 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Redefining STDOUT twice
Message-Id: <5napt1$rk0$2@dartvax.dartmouth.edu>

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


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

Date: Sat, 07 Jun 1997 10:45:48 -0400
From: Bob Wilcox <bwilcox@shianet.org>
Subject: Re: Rounding off numbers
Message-Id: <3399741C.4A8F@shianet.org>

Felix R. Penetrante wrote:
> 
> Is there a built-in perl function for rounding off floating point
> numbers.

Try sprintf.

$result = sprintf("%.2f", $number);

This will round to 2 decimal places.

---------
Bob Wilcox, perl novice...I'm just quoting an answer I saw here earlier.


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

Date: Sat, 07 Jun 1997 12:54:03 GMT
From: pschon@rede.com (Peter J. Schoenster)
Subject: Re: Standalone web database for Perl?
Message-Id: <339958e4.0@chaos.magibox.net>

Hello,

I have the Sprite.pm stuff running on my server.  If you want to look
at it in action then go here:

http://www.rede.com/samples/msql/restaurant.html

If you need any help on installing it let me know.  One thing I did
was include an "id" field.   I had trouble when modifying entries and
the use of an unchanging "id" helped.

I've also put together the Selena Sol database.  Here's an example
which should be working:

http://www.rede.com/samples/dealer/

Once you understand those you can usually put together a new database
(with forms and all) within an hour.

Of course you can use flat-files and dbm.  That's what I use at my
book site: 
http://www.rede.com/books/index.html.  

I wrote a little guestbook script that saves all entries in a database
so that you can delete whatever you want: 

http://www.rede.com/gtown

I put that on a live site (http://www.rede.com/vitoria/) and it works
as my pen-pal page.  I took out the replies that was in the earlier
version (above).  

I just got a call from a local "consulting company" who were looking
for a cgi - perl programmer (or so they were told).  They mentioned a
medical company and 9 gigs of data.  I have no formal programming
training or experience.  Would that require an Oracle or Sybase
database?  I wonder if it could be handled my mSQL?  

Any info|links to on using databases and understanding databases would
be very much appreciated.

Thanks!

Peter




"David" <burchd@erols.com> wrote:

>Sprite.pm is a delimited text database using a SQL subset that is good for
>small uses.  MSQL is available for $50 a server ( I think) if you need a
>larger solution (you
>would have to use the Perl (DBI).
>David
>burchd@erols.com

>Gary Weinfurther <gary@mich.com> wrote in article
><MPG.df65c741202955a989680@news.mich.com>...
>> A client wants a "simple" database application developed in Perl for a 
>> corporate intranet.  According to the client, the web server does not 
>> currently have a DBMS.  He wants a small, low-budget database for this 
>> application and it does not need to interact with any other application 
>> on the intranet.  Is there a Perl library that manages database records, 
>> similarly to a data management library for C or other languages?  Or do 
>> we have to purchase a large C/S RDBMS and install it on the server?
>> 
>> Thanks in advance!
>> -- 
>> 
>>    ...Gary (gary@mich.com)
>> 




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

Date: Fri, 06 Jun 1997 23:23:53 GMT
From: cgsystem@dircon.co.uk (Zac)
Subject: Windows 3.1 / Perl 4 or 5
Message-Id: <5na941$4js$1@newsserver.dircon.co.uk>

I have read a mountain of information regarding Perl but nothing seems
to address my confusion. I am a 486 / Windows 3.11 user, and have
never seen a Unix Operating System.

I understand that I can write a perl script in pure text (in Windows,
Notepad for example) and upload it to a CGI directory, and it would
run.

Is that correct?

Other information (book: "60 Minute Guide to CGI programming with Perl
5" by Robert Farrell) seems to suggest that Even though I am a windows
3.11 user, I will still need to download a programme called Perl 5.

If Perl is a pure text language, why do I need a Programme which I
presume is a compiler of some sort. If I then find this programme and
am able to run it on my Windows 3.11 operating system, will it still
run on my Service Providers Unix Platform.

Would also be grateful to discover where I might find this programme
that is able to run on Windows 3.11

ftp.uu.net  does not seem to have Perl 5 for Windows 3.11

Thanks in advance.


Zac
------



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

Date: Fri, 06 Jun 1997 23:18:50 GMT
From: cgsystem@dircon.co.uk (Zac)
Subject: Windows 3.1 / Perl 4 or 5
Message-Id: <5na8qk$4io$1@newsserver.dircon.co.uk>

I have read a mountain of information regarding Perl but nothing seems
to address my confusion. I am a 486 / Windows 3.11 user, and have
never seen a Unix Operating System.

I understand that I can write a perl script in pure text (in Windows,
Notepad for example) and upload it to a CGI directory, and it would
run.

Is that correct?

Other information (book: "60 Minute Guide to CGI programming with Perl
5" by Robert Farrell) seems to suggest that Even though I am a windows
3.11 user, I will still need to download a programme called Perl 5.

If Perl is a pure text language, why do I need a Programme which I
presume is a compiler of some sort. If I then find this programme and
am able to run it on my Windows 3.11 operating system, will it still
run on my Service Providers Unix Platform.

Would also be grateful to discover where I might find this programme
that is able to run on Windows 3.11

ftp.uu.net  does not seem to have Perl 5 for Windows 3.11

Thanks in advance.


Zac
------



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

Date: Fri, 06 Jun 1997 23:13:48 GMT
From: cgsystem@dircon.co.uk (Zac)
Subject: Windows 3.1 / Perl 4 or 5
Message-Id: <5na8h5$4fd$1@newsserver.dircon.co.uk>

I have read a mountain of information regarding Perl but nothing seems
to address my confusion. I am a 486 / Windows 3.11 user, and have
never seen a Unix Operating System.

I understand that I can write a perl script in pure text (in Windows,
Notepad for example) and upload it to a CGI directory, and it would
run.

Is that correct?

Other information (book: "60 Minute Guide to CGI programming with Perl
5" by Robert Farrell) seems to suggest that Even though I am a windows
3.11 user, I will still need to download a programme called Perl 5.

If Perl is a pure text language, why do I need a Programme which I
presume is a compiler of some sort. If I then find this programme and
am able to run it on my Windows 3.11 operating system, will it still
run on my Service Providers Unix Platform.

Would also be grateful to discover where I might find this programme
that is able to run on Windows 3.11

ftp.uu.net  does not seem to have Perl 5 for Windows 3.11

Thanks in advance.


Zac
------



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

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

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