[6935] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 560 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 2 20:11:19 1997

Date: Mon, 2 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, 2 Jun 1997     Volume: 8 Number: 560

Today's topics:
     Re: 2-way communication with unix command (Michael J Assels)
     Re: 5.004 problem with Hashes <rootbeer@teleport.com>
     Re: any editor for perl? (Tina Marie Holmboe)
     Re: C -> Perl with a lot of functions (R Bradley)
     Re: C -> Perl with a lot of functions (Nathan V. Patwardhan)
     Re: Can I perl script download a HTML page??? (Tina Marie Holmboe)
     Re: Compatibility Issues between Perl and Oracle (John D Groenveld)
     Re: data structure question (Tina Marie Holmboe)
     Re: help! i need a banner rotator... (Jeff Stampes)
     inconsistent opendir behaviour in Perl for win32 (Simon Oosthoek)
     Re: inconsistent opendir behaviour in Perl for win32 (Nathan V. Patwardhan)
     Isdigit(), isalpha()  in Perl ddean@aracnet.net
     Re: Isdigit(), isalpha()  in Perl (Nathan V. Patwardhan)
     Re: Isdigit(), isalpha()  in Perl <bryan@eai.com>
     Re: Isdigit(), isalpha()  in Perl (Kerry Schwab)
     Re: LOG base 10  operator <rootbeer@teleport.com>
     Re: Newbie question <ajohnson@gpu.srv.ualberta.ca>
     Re: Newbie question <rootbeer@teleport.com>
     Re: Newbie question (Anthony Stevens)
     Re: nth root function? (Terje Bless)
     Re: OS/2 : Backticks causing runtime crash (Ilya Zakharevich)
     Re: Output to a printer (Tina Marie Holmboe)
     Re: Own to chek if two or more words are in a string ? (Andrew M. Langmead)
     Re: Passwords in Perl <rootbeer@teleport.com>
     Re: Passwords in Perl <jbokma@caiw.nl>
     Perl 5 tutorial? (Art Blair)
     Re: Perl 5.004 is available (Terje Bless)
     print keys %something how do I sepearte each key? <User_id@webads.gr>
     Re: print keys %something how do I sepearte each key? <burleigh@hackberry.chem.niu.edu>
     problem finding library files (Curtis Hrischuk)
     Re: problem finding library files (Terje Bless)
     Re: Refresh and Environment Variables. <jbokma@caiw.nl>
     Re: Submit form via script? <jbokma@caiw.nl>
     Working with multiple files (simultaneously). (CHAN TANG Eric-Aubert)
     Re: Working with multiple files (simultaneously). (CHAN TANG Eric-Aubert)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Jun 1997 21:32:01 GMT
From: mjassels@cs.concordia.ca (Michael J Assels)
Subject: Re: 2-way communication with unix command
Message-Id: <5mve4h$2sk$1@newsflash.concordia.ca>

In article <m3lo4ssv7a.fsf@windlord.Stanford.EDU>,
Russ Allbery  <rra@stanford.edu> wrote:
>Michael J Assels <mjassels@cs.concordia.ca> writes:
>> ...
>
>5.004 is a production release.  The Perl home page is currently a bit
>behind.

Hmm!  I must have missed it while I was on vacation.  Thanks.

>-- 
>#!/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

Very nice, but you have far too many alphanumerics :-)

Michael


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

Date: Mon, 2 Jun 1997 16:00:50 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Prince Mystery <mystery@itis.com>
Subject: Re: 5.004 problem with Hashes
Message-Id: <Pine.GSO.3.96.970602155845.14796B-100000@kelly.teleport.com>

On Mon, 2 Jun 1997, Prince Mystery wrote:

> Odd number of elements in hash list at...

> %final = {};

It's good that Perl is complaining about that, because it can't possibly
be doing anything useful. :-)  What you wanted must have been to set
%final to an empty hash, which looks like this. 

    %final = ();

Hope this helps!

-- 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: 2 Jun 1997 22:14:21 +0200
From: tina@htmlhelp.com (Tina Marie Holmboe)
Subject: Re: any editor for perl?
Message-Id: <5mv9it$cu0@hrotti.ifi.uio.no>

 = David Combs =

> Does no one reading this newsgroup use Emacs??????

  Of course, but the rules of EA ( Emacsusers Anonymous ) states that we
are not allowed to admit that outside of a safe environment...

  That said, I use only emacs for my perling, of course in fundamental
mode. The only thing I really *miss* is a built-in interpreter, and a 
debugger to which I could feed input and have it tell me whether my
program would stop on that input or not.
 
  Wow; I'd love that...


  (Disclaimer: I know. It's called 'rehashing'. I just could't help myself >:)

--
 Tina Marie Holmboe
 [ tina@htmlhelp.com    ]      WDG     [ http://www.htmlhelp.com/%7Etina/    ]
 [ tina@ifi.uio.no      ]  University  [ http://www.ifi.uio.no/%7Etina/      ]
 [ tina@elfi.adbkons.se ]    Private   [ http://www.elfi.adbkons.se/%7Etina/ ]


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

Date: 2 Jun 1997 21:13:28 GMT
From: rick@rentec.com (R Bradley)
Subject: Re: C -> Perl with a lot of functions
Message-Id: <5mvd1o$8ea@puma.rentec.com>

Egghat (egghat@vocalweb.de) wrote:
: I habe got a large set of c functions, which I plan to use inside
: Perl. I have read through the man pages perlxs and it's tutorial. 
: AFAIK I have to create a lot of .xs files, which include the C source.
: But my c files have to remain "C compilable" and it would by quite a
: disaster to maintain two trees of the same files. 
: Is there any possibilty to automagically create perl headers from the
: C sources? And, do I have to create all those .xs files manually and
: do I have to include the C-source into the .xs files?
: Any other ways to get my c functions into perl?

Take a look at SWIG (http://www.cs.utah.edu/~beazley/SWIG).
It's a utility for doing just what you're looking for (also does
Tcl and Python).  Supports up through Perl 5.004 and has some 
pretty sophisticated features (turning C structs into perl
classes, with hash assignment and lookup...).

Full documentation is on-line.

Rick


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

Date: 2 Jun 1997 23:36:14 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: C -> Perl with a lot of functions
Message-Id: <5mvlde$7uu@fridge-nf0.shore.net>

Egghat (egghat@vocalweb.de) wrote:

: AFAIK I have to create a lot of .xs files, which include the C source.
: But my c files have to remain "C compilable" and it would by quite a
: disaster to maintain two trees of the same files. 

I don't think it's that difficult, or cumbersome.  See a Module like
GD for examples.

: Is there any possibilty to automagically create perl headers from the
: C sources? And, do I have to create all those .xs files manually and
: do I have to include the C-source into the .xs files?

Personally, I prefer using one .xs file, and building a custom Makefile
for the C files in my src directory.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 2 Jun 1997 22:14:22 +0200
From: tina@htmlhelp.com (Tina Marie Holmboe)
Subject: Re: Can I perl script download a HTML page???
Message-Id: <5mv9iu$cu1@hrotti.ifi.uio.no>

 = Dean Pentcheff =

> A cursory search in any WWW search site would have yielded: 
> http://www.perl.com  .

  'cuse me for butting in like this with a slightly (!) off-topic comment,
but when refering to URLs that point to servers or directories as opposed
to files, please remember to include the '/' at the end, ie.

    http://www.perl.com/

  and not

    http://www.perl.com


  Thanx...

--
 Tina Marie Holmboe
 [ tina@htmlhelp.com    ]      WDG     [ http://www.htmlhelp.com/%7Etina/    ]
 [ tina@ifi.uio.no      ]  University  [ http://www.ifi.uio.no/%7Etina/      ]
 [ tina@elfi.adbkons.se ]    Private   [ http://www.elfi.adbkons.se/%7Etina/ ]


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

Date: 2 Jun 1997 18:23:18 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Compatibility Issues between Perl and Oracle
Message-Id: <5mvh4m$d4u$1@tholian.cse.psu.edu>

In article <5mmvs7$q25$1@news-sj-2.cisco.com>,
Michael Swertfager <mswertfa@cisco.com> wrote:
>I have heard rumors about compatiblity issues between Perl and Oracle.

Rumor monger! Please clarify you question. If you are asking if you can
access your Oracle database from a Perl script, then the answer is yes,
see the Module List. In fact, Oracle ships perl and the appropriate modules
with its Webserver 3.0.

John
groenvel@cse.psu.edu


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

Date: 2 Jun 1997 22:14:19 +0200
From: tina@htmlhelp.com (Tina Marie Holmboe)
Subject: Re: data structure question
Message-Id: <5mv9ir$ctv@hrotti.ifi.uio.no>

 = Jon Nathan =

> etc.  the format for the file is not written in stone, however it seemed 
> good to me at the time.  once it reads in all the quotes from the file, it 
> should print one out at random, along with the source.  because i would 
> eventually like to play with the source too, i want to keep it in a seperate
> variable.  that said, this is my (ugly) code so far:

  Evenin' Jon...

  When I see problems such as these, and the classic solution of stuffing
everything into an array, I recall my old quotes-file. 700 Kb worth of
more-or-less interesting quotes - and I vividly recall running out of
memory when doing similar things.

  So:

  1) Do you _need_ to have all the data in memory at a time ?
  2) Are you against changing the format into something like this:

     quote1
     source1

     quote2
     source2

     ...

     quoteN
     sourceN

     ?

  If you can answer those two questions with "No", then I'd suggest
doing something like this:

  == Begin Partially Tested Perl Code ==

#! /usr/bin/perl
                                        # You might consider running it with
                                        # the -w flag...

                                        # This can be done better :) but is
                                        # prolly sufficient for this use.
 srand(time) ;
                                        # Get a random quote. Make sure that it
                                        # ain't 0, (No, Randal, you can't roast
                                        # me just for this! :) and that it is 
                                        # an int.
 my($num) = 0 ; while ( $num == 0 ) { $num = int(rand(4)) ; }

                                        # Set the 'input record separator' to
                                        # two newlines; ie. a block of data
                                        # separated from the next by a blank
                                        # line
 $/ = "\n\n" ;
                                        # Open the file, and check for any
                                        # errors. Remember to always output the
                                        # $! variable.
 open(PTR, "<dummy.dta") || die("Unable to open dummy.dta, $!\n") ;

                                        # Traverse the file, and count up.
 while( ($i++ < $num) && ( $data = <PTR> ) ) {}

                                        # Use a regexp to split out the first
                                        # line into the $quote scalar, and the
                                        # source into the $source one.
                                        # Remember to use a /s modified on the
                                        # regexp to make it treat the string
                                        # as a single line.
 my($quote, $source) = ( $data =~ /(.*)\n(.*)/si ) ;

                                        # Print out the source - or rather: do
                                        # what you want with it.
 print "Quote: ($quote) Source: ($source)\n" ;

  == End Partially Tested Perl Code ==

  This works quite nicely on the following data-file:

Take me out to the ballgame.
Some song

Whatever
Joe Smith

Just another Perl Hacker
Randal Schwartz

  >:)

--
 Tina Marie Holmboe
 [ tina@htmlhelp.com    ]      WDG     [ http://www.htmlhelp.com/%7Etina/    ]
 [ tina@ifi.uio.no      ]  University  [ http://www.ifi.uio.no/%7Etina/      ]
 [ tina@elfi.adbkons.se ]    Private   [ http://www.elfi.adbkons.se/%7Etina/ ]


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

Date: 2 Jun 1997 20:37:58 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: help! i need a banner rotator...
Message-Id: <5mvav6$7k9$1@neocad.com>

Astro (astro@vaxxine.com) wrote:
: anybody have or know of a good banner rotation cgi's???

I'm sure someone does. 

Did you try comp.infosystems.www.authoring.cgi??

--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: 2 Jun 1997 21:47:54 GMT
From: s.oosthoek@student.utwente.nl (Simon Oosthoek)
Subject: inconsistent opendir behaviour in Perl for win32
Message-Id: <5mvf2a$5go@pandora.cs.utwente.nl>

Hi,

I want to use a commandline parameter with a directory, which I'm going 
to parse recursively.
When the parameter ends in a "\", the opendir function fails the first 
time:

  $dir contains the commandline parameter.

  opendir (DIR, $dir) or die "cannot open $dir\n";
    my @list = readdir (DIR);
  closedir (DIR);

examples of calling:
script d:\    -> error
script d:\.   -> ok
script d:     -> error
script \      -> error
script d:\dir -> ok
script .      -> ok

any clues?

Thanks in advance,

Simon.

please cc me, when replying; I don't trust the newsserver I use to get 
every reply. Don't worry, I have a valid e-mail address configured.



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

Date: 2 Jun 1997 23:39:24 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: inconsistent opendir behaviour in Perl for win32
Message-Id: <5mvljc$7uu@fridge-nf0.shore.net>

Simon Oosthoek (s.oosthoek@student.utwente.nl) wrote:

: When the parameter ends in a "\", the opendir function fails the first 
: time:

Hint: don't use \ in your directory names.  Do it this way, and your
life will be easier:

$dir = 'd:/';

opendir(DIR, $dir) || die("opendir error: $!");
etc etc

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Mon, 02 Jun 1997 12:10:18 -0400
From: ddean@aracnet.net
Subject: Isdigit(), isalpha()  in Perl
Message-Id: <3392F06A.32B8@aracnet.net>

Is there a function similar to the C functions isdigit or alpha in Perl

Thanks
Dean


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

Date: 2 Jun 1997 21:51:57 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Isdigit(), isalpha()  in Perl
Message-Id: <5mvf9t$18s@fridge-nf0.shore.net>

ddean@aracnet.net wrote:
: Is there a function similar to the C functions isdigit or alpha in Perl

Yes, but not called isdigit or isalpha.  There are many ways to do
this, but I'd suggest looking into regexps.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Mon, 02 Jun 1997 17:09:08 -0500
From: Bryan Hart <bryan@eai.com>
To: ddean@aracnet.net
Subject: Re: Isdigit(), isalpha()  in Perl
Message-Id: <33934484.41C6@eai.com>

ddean@aracnet.net wrote:
> 
> Is there a function similar to the C functions isdigit or alpha in Perl
> 
> Thanks
> Dean

unless ( $var =~ /\D/ ){
	do stuff;
}

will test for digits (true unless $var includes a non-digit)

unless ( $var =~ /\W/ ) {
   unless ($var =~ /\d/ ){
      do stuff;
   }
}

will test for alphas (true unless $var includes a non-word, true unless
the word contains a digit)

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: 2 Jun 1997 16:32:47 -0600
From: kschwab@nyx10.cs.du.edu (Kerry Schwab)
Subject: Re: Isdigit(), isalpha()  in Perl
Message-Id: <5mvhmf$4n2@nyx10.cs.du.edu>

In article <3392F06A.32B8@aracnet.net>,  <ddean@aracnet.net> wrote:
>Is there a function similar to the C functions isdigit or alpha in Perl
>
>Thanks
>Dean

I usually do this sort of thing with regexps.  If you really want
the functions....


sub isdigit {
  my($string)=shift;
  $string=~/^\d+$/;
}
sub isalpha {
  my($string)=shift;
  $string=~/^[a-z|A-Z]+$/;
}


--
Kerry


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

Date: Mon, 2 Jun 1997 15:58:23 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Michael J. Rocchetti" <miker@maverick.facil.uconn.edu>
Subject: Re: LOG base 10  operator
Message-Id: <Pine.GSO.3.96.970602155550.14796A-100000@kelly.teleport.com>

On 2 Jun 1997, Michael J. Rocchetti wrote:

> Does anyone know how to take the log base 10 of a number using PERL?

Sure...

   sub log10 ($) { log($_[0])/log(10) }

Hope this helps!

-- 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, 02 Jun 1997 13:23:28 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Newbie question
Message-Id: <33930FA0.6DF85F0B@gpu.srv.ualberta.ca>

! To get the number of characters in a string, I'm using the
! following:
! 
! sub ChkQID {
!     my ($QID) = @_;
!     my ($nchars, $i);
! 
!     $_ = $QID;
!     $nchars = tr/\000-~//; # get the number of characters
! 
! Is there a better way?

$num_chars=length($string);

regards
andrew


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

Date: Mon, 2 Jun 1997 16:07:12 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: nospam@nospam.net
Subject: Re: Newbie question
Message-Id: <Pine.GSO.3.96.970602160406.14796F-100000@kelly.teleport.com>

On Mon, 2 Jun 1997, Bill Thompson wrote:

> Reply-To: nospam@nospam.net

Okay, if you say so. :-)

> Subject: Newbie question

The first question you should ask is "How can I put better subject lines
on my postings?" And the answer is "By reading the frequent posting on
that topic." :-)

> To get the number of characters in a string, I'm using the following:
> 
> sub ChkQID {
>     my ($QID) = @_;
>     my ($nchars, $i);
> 
>     $_ = $QID;
>     $nchars = tr/\000-~//;        # get the number of characters
> 
> Is there a better way?

Yes! Perl has a built-in length() function which will be much faster. 
(And it has an easier-to-remember name. :-)  It's documented in
perlfunc(1), along with lots of other cool goodies. 

Hope this helps!

-- 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: 2 Jun 1997 15:31:54 GMT
From: astevens@asdf.austin.ibm.com (Anthony Stevens)
Subject: Re: Newbie question
Message-Id: <slrn5p5pra.102m.astevens@asdf.austin.ibm.com>

On Mon, 02 Jun 1997 10:05:01 -0400, Bill Thompson <nospam@nospam.org> wrote:
>
>To get the number of characters in a string, I'm using the following:
>
[Silly code snipped]

The easyest way to get the number of characters in a string is 
length($string)



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

Date: Mon, 02 Jun 1997 22:17:45 +0200
From: link@tss.no (Terje Bless)
Subject: Re: nth root function?
Message-Id: <link-YANW300b2-0206972217450001@news.uit.no>

In article <8ck9kcvnne.fsf@gadget.cscaper.com>,
    Randal Schwartz <merlyn@stonehenge.com> wrote:

>>>>>> "liamtu" == liamtu  <liamtu@echonyc.com> writes:
>
>liamtu> is there a secret nth root function in perl? has anyone written one?
>liamtu> Any advice?... C?
>
>Yeah.  Pretty secret:
>
>        $nth_root_of_x = $x ** (1/$n);

Or maybe even:

sub nth ($) {return $_[0] ** (1/$n)} # :-)

-- 
Party? Party, lord? Yes, lord. Right away, lord.
        - Beopunk Cyberwulf


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

Date: 2 Jun 1997 21:48:11 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: OS/2 : Backticks causing runtime crash
Message-Id: <5mvf2r$3ou$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Koos Pol
<koos_pol@nl.compuware.com.NO_JUNK_MAIL>],
who wrote in article <5mtpgl$od4@news.nl.compuware.com>:
> In <5mneni$f4e$2@mathserv.mps.ohio-state.edu>, ilya@math.ohio-state.edu (Ilya Zakharevich) writes:

> >You still did not put Perl docs into your bookbag...

> Oh yes I did :-) But as you may have noticed my name being new to this
> list (all those silly OS/2 questions in just a couple of days...), you
> may also appreciate that Perl -with it's typical Unix style of going
> about- it not the easiest matter for a typical PC guy. And the docs are
> about 5 foot thick. So, I am getting there but not today or tomorrow.

Note you are on OS/2, so you are able to use (probably?) the best
online Perl docs.  I would try

	view perl ``
	view perl backticks

or just

	view perl

and do a global search on `` and/or backticks.

Ilya


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

Date: 2 Jun 1997 22:14:18 +0200
From: tina@htmlhelp.com (Tina Marie Holmboe)
Subject: Re: Output to a printer
Message-Id: <5mv9iq$ctt@hrotti.ifi.uio.no>

 = Markus Ulsa<DF> =

> How can I print out something to a printer, w/o printing it first to a
> file and then print it to a printer (with "help" from the OS)?

  Acknowledging that I do not know much about WinNT, and cannot tell you
whether Win95 overrides the OS, the usual technique for doing this on a
DOS-based platform is by opening a file named 'LPT1:' - ie. the default
printer port.

  open(PRINTER, ">>LPT1:") || die("Unable to open LPT1:, $!\n") ;
  print "$Date\t $Photographer\t $Fee\n";
  close(PRINTER) ;

  This, althought it has been a while, should work under DOS. Perchance
you can test this under Win95/DOS and WinNT ? Good luck.

--
 Tina Marie Holmboe
 [ tina@htmlhelp.com    ]      WDG     [ http://www.htmlhelp.com/%7Etina/    ]
 [ tina@ifi.uio.no      ]  University  [ http://www.ifi.uio.no/%7Etina/      ]
 [ tina@elfi.adbkons.se ]    Private   [ http://www.elfi.adbkons.se/%7Etina/ ]


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

Date: Sun, 1 Jun 1997 19:12:41 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Own to chek if two or more words are in a string ?
Message-Id: <EB42p5.E8v@world.std.com>

ccadic@aol.com (Ccadic) writes:

>I would like to find a function that is able to check if two or more words
>appear in a string an dreturn true o r False

Grab a book on perl, or the man pages and look at the index() function
or regular expressions, as well as looping constructs.

>$true = 1;
 
You might want to try to avoid defining "true" and "false". Since
there are many true values, (and in perl, a few false values as well.)
you'll find yourself tripping up later when something returns a true
value other than 1.

>if &chek (('Hi','pentium') = $true) {Print (" 2 Words found")}
>if &chek (('Hi','pentium,talking') = $true) {Print (" 3 Words found")}

sub check {
 # string to check
 my $source = shift;
 # substrings to check for
 my @findthese = @_;
 # holds current substring
 my $findthis;
 # holds count of substrings that match
 my $count = 0;

 # for each substring
 for $findthis (@findthese) {
   # increment count if it exists in the source string
   $count++ if index $source,$findthis != -1;
 }
 # return the number of matches found.
 return $count;
}

If you are going to do a large number of repeated single word matches
against the same string, you might want to split the source string up
into words, store them in a hash, and check for the existence of a
word in the hash. The time spent splitting the string and filling the
hash will be greater, but then each following lookup will be a
constant time, rather than proportional to the string size.

-- 
Andrew Langmead


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

Date: Mon, 2 Jun 1997 16:03:11 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: John F Duggan <duggan@kira.ecs.umass.edu>
Subject: Re: Passwords in Perl
Message-Id: <Pine.GSO.3.96.970602160118.14796C-100000@kelly.teleport.com>

On 2 Jun 1997, John F Duggan wrote:

> Is this secure if combined with the Commerce Server?

Gee, this smells like a server question, instead of a Perl question. Try
asking in a server newsgroup (or checking their FAQ) since around here, we
know only about Perl. :-)

> One last problem that I have is that if I used the TYPE=password, then I have
> the password displayed with the NETSITE url at the top of the page within
> Netscape. 

I think that's a browser problem (or maybe HTML?) but it's not Perl
either. 

Good luck!

-- 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: 2 Jun 1997 21:19:28 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Passwords in Perl
Message-Id: <01bc6f9a$56521d40$c50ab2c2@tschai>



John F Duggan <duggan@kira.ecs.umass.edu> wrote in article
<5mujaa$bp9$1@risky.ecs.umass.edu>...
> Hello,
> 
> I am working on acessing a database via a web browser. I have the
database
> access up and running just fine. But I need to be able to pass a
username and
> password for database access to the SQL statements that I have. The
perl
> scripts are running under Netscape's Commerce Server. 
> 
> According to page 394 of the CGI programming book by O'Reilly:
> 
>     The password field in the TYPE=password is not secure.

As the password is sent over the internet, it is never secure,
because when
someone intercepts it, it can use what you sent as a password...


> Is this secure if combined with the Commerce Server.

I don't think so.

> 
> One last problem that I have is that if I used the TYPE=password,
then I have
> the password displayed with the NETSITE url at the top of the page
within
> Netscape. 

Use POST instead of GET in your FORM.

John


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

Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)

http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]

email: jbokma@caiw.nl  phone: +31 10 4291827



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

Date: 2 Jun 1997 21:44:14 GMT
From: blair@sf73.dseg.ti.com (Art Blair)
Subject: Perl 5 tutorial?
Message-Id: <5mvere$6ot@sf18.dseg.ti.com>


IMO,"Programming Perl" might make a fine reference but it's NOT
written for someone who doesn't already know perl.
Can anyone recommend a tutorial style book that includes
OOP & CGI?
Thanx,
Art.


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

Date: Mon, 02 Jun 1997 23:03:32 +0200
From: link@tss.no (Terje Bless)
Subject: Re: Perl 5.004 is available
Message-Id: <link-YANW300b2-0206972303320001@news.uit.no>

In article <FAQ-NOT-FOR-EMAIL-2905970651010001@bohdan.dialup.access.net>,
    FAQ-NOT-FOR-EMAIL@Tryzub.com (Bohdan Peter Rekshynskyj) wrote:

Is that a valid (i.e. deliverable) email address?

>But what about the Macintosh?

It's not available yet (AFAIK). When it becomes available it'll be
announced on the MacPerl mailinglist. If you work with Perl on a Macintosh
you should subscribe to it.

To subscribe to the mac-perl list, send mail to
mac-perl-request@iis.ee.ethz.ch whose BODY (the Subject is ignored) is the
word "subscribe" or "unsubscribe". To subscribe to the mac-perl-announce
list, send this mail to mac-perl-announce-request@iis.ee.ethz.ch instead.
All traffic to the announce mailing list automatically appears on the
regular mailing list, too, so there is no need to subscribe to both of
them.

-- 
Party? Party, lord? Yes, lord. Right away, lord.
        - Beopunk Cyberwulf


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

Date: 2 Jun 1997 19:47:16 GMT
From: "Dimitiris Vayenas" <User_id@webads.gr>
Subject: print keys %something how do I sepearte each key?
Message-Id: <01bc6f96$b1915300$fceb1ec2@ft>

I wonder if anyone has found a way of getting - out of the print keys
%something (or print values %something) each key separated by a user
defined delimiter?

Thanking you in Advance,

Dimitris


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

Date: Mon, 02 Jun 1997 18:18:59 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: print keys %something how do I sepearte each key?
Message-Id: <339354E3.2B3B@hackberry.chem.niu.edu>

Dimitiris Vayenas wrote:
> 
> I wonder if anyone has found a way of getting - out of the print keys
> %something (or print values %something) each key separated by a user
> defined delimiter?
> 
> Thanking you in Advance,
> 
> Dimitris

you mean something like 
print join($delimiter, keys(%something) );
?
-- 
==========================================================
 - darin
burleigh@hackberry.chem.niu.edu
\\//\\//.\\//\\//.\\//\\//. http://hackberry.chem.niu.edu/HOME/dcb/
 '2 kinds of green, look out!' - dieter rot


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

Date: 02 Jun 1997 19:02:22 GMT
From: ceh@pegasus.sce.carleton.ca (Curtis Hrischuk)
Subject: problem finding library files
Message-Id: <CEH.97Jun2150222@pegasus.sce.carleton.ca>

Hi.  My perl 5.5 script is having a hard time finding the perl
packages Graph::Node and Graph::Edge.  These files reside in the
directory /home/ceh/lan/perl/src/.  The standard distribution was
installed at /usr/local/lib/perl5.	

I have attempted the following, all of which do no good:
(1) The environement variable is PERL5LIB is set to 
	PERL5LIB=/home/ceh/ObjecTime/xa:/home/ceh/lan/perl:/home/ceh/lan/perl/src:/home/ceh/lan/perl/src/Graph

(2) The following lines occur in the top level perl file:
	use lib '/home/ceh/ObjecTime/xa:/home/ceh/lan/perl/src';
	push(@INC, '/home/ceh/ObjecTime/xa');
	push(@INC, '/home/ceh/lan/perl/src');

(3) The first line of the top level perl file is:
	#! /usr/local/bin/perl -w -I/home/ceh/lan/perl/src

The error message is:
	Taeg.pm
	Can't locate package Graph::Node for @ActivityNode::ISA at Taeg.pm line 32 (#1)
	    (W) The @ISA array contained the name of another package that doesn't seem
	    to exist.
	    
	Can't locate package Graph::Node for @AndJoinNode::ISA at Taeg.pm line 33 (#1)
	Can't locate package Graph::Edge for @AsyEdge::ISA at Taeg.pm line 34 (#1)
	

Why am I getting this error? 

Thanks for your time.

Curtis
-- 
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Curtis Hrischuk (PhD Cand)  "in reality that comes from above      _/
_/ ceh@sce.carleton.ca          God is calling                        _/
_/ Carleton University          there's no bigger love                _/
_/ Ottawa, On., Canada, K1S-5B6 It's his reality that welcomes us back_/
_/ Ph  (613) 520-2600 x1762     Trust and obey                        _/
_/ FAX (613) 520-5727           there is no other way..." the newsboys_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


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

Date: Tue, 03 Jun 1997 00:43:47 +0200
From: link@tss.no (Terje Bless)
Subject: Re: problem finding library files
Message-Id: <link-YANW300b2-0306970043470001@news.uit.no>

In article <CEH.97Jun2150222@pegasus.sce.carleton.ca>,
ceh@pegasus.sce.carleton.ca (Curtis Hrischuk) wrote:

>Hi.  My perl 5.5 script is having a hard time finding the perl

5.5??? The current version is '5.004' AFAIK.


>packages Graph::Node and Graph::Edge.  These files reside in the
>directory /home/ceh/lan/perl/src/.  The standard distribution was
>installed at /usr/local/lib/perl5.      
>
>(2) The following lines occur in the top level perl file:
>        use lib '/home/ceh/ObjecTime/xa:/home/ceh/lan/perl/src';

Try:

    use lib qw(/home/ceh/ObjecTime/xa /home/ceh/lan/perl/src);

The syntax is:
    use lib LIST;

You seem to be using shell $path syntax.

link@ramses:~<1>perl
use lib qw(/home/ceh/ObjecTime/xa /home/ceh/lan/perl/src);
print join "\n", @INC, '';
^D
/home/ceh/ObjecTime/xa
/home/ceh/lan/perl/src
/usr/local/lib/perl5/IP22-irix/5.003
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/IP22-irix
/usr/local/lib/perl5/site_perl
 .
link@ramses:~<2>

-- 
Party? Party, lord? Yes, lord. Right away, lord.
        - Beopunk Cyberwulf


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

Date: 2 Jun 1997 21:21:09 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Refresh and Environment Variables.
Message-Id: <01bc6f9a$92b7d860$c50ab2c2@tschai>



John F Duggan <duggan@kira.ecs.umass.edu> wrote in article
<5mujmk$bp9$2@risky.ecs.umass.edu>...
> Hello,
> 
> I have been using a refresh within a perl script to allow me to
clear the
> query string information from being displayed as part of the url. I
do this
> by setting the refresh time for 0. When I do this, I lose all of
the Envir-
> onment Variables information. Is there any way around that? Would
embedding
> the refresh within a form solve the problem?

Use POST instead of GET

John


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

Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)

http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]

email: jbokma@caiw.nl  phone: +31 10 4291827



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

Date: 2 Jun 1997 21:23:20 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Submit form via script?
Message-Id: <01bc6f9a$df865220$c50ab2c2@tschai>



Bob Wilkinson <b.wilkinson@pindar.co.uk> wrote in article
<b.wilkinson-0206971419320001@ip57-york.pindar.co.uk>...
> In article <338BF650.3CD4@moriah.com>, scott@moriah.com wrote:
> 
> > Question: +++++++++++
> > Is it possible to submit a form via a script instead of having to
> > "click" on a submit button?
> > 
> > Background (fluff!): +++++++++++
> > We are adding 500+ of our clients pages to many of the search
engines. I
> > have already written a script which gathers descriptions and the
like
> > from their pages on our site and then presents me with a list of
buttons
> > from each of the search engines.
> > 
> > However, it makes more sense to me to click one button and have a
script
> > submit all the forms. Taking this a step further, I could simply
give a
> > list of URL's to the script and let it do the work.

Call the CGI submission scripts with a pseudo-browser written in Perl
(i.e. open
the submission url, e.d.
www.search.thingy.com/cgi-bin/addurl?yoururl)

regards,

John


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

Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)

http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]

email: jbokma@caiw.nl  phone: +31 10 4291827





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

Date: 2 Jun 1997 20:09:55 GMT
From: chantane@JSP.UMontreal.CA (CHAN TANG Eric-Aubert)
Subject: Working with multiple files (simultaneously).
Message-Id: <5mv9aj$gp0@epervier.CC.UMontreal.CA>

Is it possible to work with multiples file handles simultaneously?

For example (in pseudo-code):

sub FileCopy
{
 my ($original, @copies) = @_;

 # open $original
 # open each @copies in a table of file handles

 # for each line read from $original
  # write the line in each @copies

 # close $original
 # close all @copies
}


Thanks in advance.

-- 
  ____________________________________________________________
   (3/1R&() Eric-Aubert Chan Tang <chantane@JSP.UMontreal.CA>
            http://www.jsp.umontreal.ca/~chantane/


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

Date: 2 Jun 1997 20:18:01 GMT
From: chantane@JSP.UMontreal.CA (CHAN TANG Eric-Aubert)
Subject: Re: Working with multiple files (simultaneously).
Message-Id: <5mv9pp$gp0@epervier.CC.UMontreal.CA>

[ On 2 Jun 1997 20:09:55 GMT, chantane@JSP.UMontreal.CA said :
| Is it possible to work with multiples file handles simultaneously?
| 
| For example (in pseudo-code):
| 
| sub FileCopy
| {
|  my ($original, @copies) = @_;
| 
|  # open $original
|  # open each @copies in a table of file handles
| 
|  # for each line read from $original
|   # write the line in each @copies
| 
|  # close $original
|  # close all @copies
| }

Of course, it's not for copies.

I should have ask: Is it possible to create arrays of
file handles?

 Those <FILE>, and not the contents like
 my %table;
 @file = <FILE>;
 $table{$index} = @file;

You get the idea.


Thanks again.
-- 
  ____________________________________________________________
   (3/1R&() Eric-Aubert Chan Tang <chantane@JSP.UMontreal.CA>
            http://www.jsp.umontreal.ca/~chantane/


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

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

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