[6693] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 318 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 16 19:07:59 1997

Date: Wed, 16 Apr 97 16:00:30 -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           Wed, 16 Apr 1997     Volume: 8 Number: 318

Today's topics:
     Re: "Dummies" book any good? <amethyst@maxwell.ml.org>
     Re: "rename" PLEASE HELP!!! <merlyn@stonehenge.com>
     [Q] Embed help/code sought (Charles Thayer)
     Re: A Program to List All Dirs/SubDirs <merlyn@stonehenge.com>
     Re: Array Elements <sastcm@unx.sas.com>
     C++Builder means Future. 34110s96@student.csi.cuny.edu
     Re: DNS reverse lookup - gethostbyaddr() - Thanks ! (Roland)
     Dynamic scoping with local rchannav@transquest.com
     Good editor for W95? <rascal@inlink.com>
     Re: Good editor for W95? <tchrist@mox.perl.com>
     Re: Info about Oraperl (John D Groenveld)
     Input Loop Consumes Resources (Matt Garretson)
     Looking for PERL for the RM400 from SNI (Siemens Nixdor wh@etc.hansenet.de
     more Re: system(); problem <bartolonem@med.ge.com>
     Multiple access to dbm files (Dave Newman)
     Re: Perl & NT & Oracle <eu000628@eunet.be>
     Re: Perl parsing <flg@vhojd.skovde.se>
     Q:calling perl script into JavaScript? <debi@earthling.net>
     Re: Reading another line in an input loop? (Colin Kuskie)
     Re: Reading One Character at a time (Mike Stok)
     Re: Reading One Character at a time <sib@worldnet.att.net>
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and <erik@naggum.no>
     Source code security for Perl 5 on NT (Activeware) <johnk@krypton.mankato.msus.edu>
     Re: system(); problem <tchrist@mox.perl.com>
     Re: Unix and ease of use  (WAS: Who makes more ...) (Kaz Kylheku)
     Re: Unix and ease of use  (WAS: Who makes more ...) (Ryurick M. Hristev)
     Re: WANTED: perl guru ;-) <gwhassan@prodigy.net>
     Re: What does "UNIX" stand for.. <dean@cyberzone-inc.com>
     Re: Who makes more $$ - Windows vs. Unix programmers? (Mark Culotta)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 16 Apr 1997 21:07:58 GMT
From: Neil Moore <amethyst@maxwell.ml.org>
Subject: Re: "Dummies" book any good?
Message-Id: <m2208a1xsh.fsf@maxwell.ml.org>

abigail@fnx.com (Abigail) writes:
> On Wed, 16 Apr 1997 10:51:40 GMT, Jonathan Peterson wrote in
> comp.lang.perl.misc <URL: news:3354ab99.3478663@news.sonnet.co.uk>:
> ++ 
> ++ Explaining to a real beginner that:
> ++ 
> ++ if ($a == 1) {
> ++ 	print ("Whee!");
> ++ 	}
> ++ 
> ++ is the same as
> ++ 
> ++ $a || print ("Whee!");> 
> 
> Ok, then what do you do if the beginner set $a to 2 and complains it
> prints "Whee" in the second case and not in the first?

Figure out what's wrong with that beginner's Perl to keep it from
short-circuiting with `||'. :)

-- 
-Neil Moore          http://www.sfhs.floyd.k12.ky.us/~amethyst/
(finger amethyst@valjean.sfhs.floyd.k12.ky.us for my Geek Code)


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

Date: 16 Apr 1997 15:13:14 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: stampes@xilinx.com (Jeff Stampes)
Subject: Re: "rename" PLEASE HELP!!!
Message-Id: <8c208ad3b9.fsf@gadget.cscaper.com>

>>>>> "Jeff" == Jeff Stampes <stampes@xilinx.com> writes:

Jeff> : rename ("$var1", "$var2");

Jeff> More noise...the quotes aren't needed here.

Nor are the parens. :-)

	rename $var1, $var2;

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 502 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 16 Apr 1997 17:02:31 -0400
From: thayer@mediabridge.com (Charles Thayer)
Subject: [Q] Embed help/code sought
Message-Id: <199704162102.RAA12207@astor.mediabridge.com>


[ Using: perl 05.00703 ]

I'm having trouble putting together the simplest of C programs with an
embedded perl interpreter.  Does anyone have a simple code snippet
they could send, or a pointer to something that uses this feature.

The code here is basically cut from the perlembed and perlguts manpages.

/charles
PS.  Compiles using ExtUtils::Embed, something like:

gcc foo.c -o foo  -L/usr/local/lib
/usr/local/gnu/lib/perl5/sun4-sunos/5.00307/auto/DynaLoader/DynaLoader.a
- -L/usr/local/gnu/lib/perl5/sun4-sunos/5.00307/CORE -lperl -lnsl -ldbm
- -ldb -ldl -lm -lc -lposix  -I/usr/local/include     -I/usr/local/gnu/lib/perl5/sun4-sunos/5.00307/CORE

/************************************************************************/
/* This just seg-faults on me */

#include <EXTERN.h>
#include <perl.h>

PerlInterpreter *pi = 0;

int main(int argc, char** argv, char** envp)
{
  SV *sv = 0;
  char *vtext = "print \"hello world\\n\"";

  pi = perl_alloc();
  if (!pi) {
    printf("Couldn't create perl interpreter");
    return;
  }
  perl_construct(pi);

  printf("perl evaling: `%s'", vtext);
  sv = newSVpv(vtext, 0);
  if (sv) perl_eval_sv(sv, 0);
  else printf("Couldn't generate scalar");
}


/************************************************************************/

/* This one causes this error:
   perl> ./foo2
   Global symbol "_eval_" requires explicit package name.
   Segmentation fault (core dumped)
*/

#include <EXTERN.h>
#include <perl.h>

PerlInterpreter *pi = 0;

int perl_eval(char *string)
{
  char *argv[2];
  argv[0] = string;
  argv[1] = NULL;
  perl_call_argv("_eval_", 0, argv);
}

int main(int ac, char** av, char **ep)
{
  char *string = "print \"hello world\\n\"";
  if (pi) return;
  pi = perl_alloc();
  if (!pi) return;
  perl_construct(pi);
  perl_eval(string);
}


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

Date: 16 Apr 1997 15:22:12 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: wayne@netcom.com (wayne t. watson)
Subject: Re: A Program to List All Dirs/SubDirs
Message-Id: <8cu3l6bobv.fsf@gadget.cscaper.com>

[oops ignore other one]

>>>>> "wayne" == wayne t watson <wayne@netcom.com> writes:

wayne> Anyone have a simple program to list all
wayne> the directories and subdirectories below a given
wayne> directory?  Maybe something like:

wayne> A
wayne>   A1
wayne>   A2
wayne>     A2.1
wayne>     A2.2
wayne> B
wayne>   B1
wayne>   B2
wayne> C
wayne> D
wayne>   D1

Too easy.

	use File::Find;
	find sub {
	    my $n = $File::Find::name;
	    $n =~ s#.*?/#    #gs;
	    $n .= "/" if -d;
	    print "$n\n";
	}, "top1","top2","top3"; # or maybe "."

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 502 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Wed, 16 Apr 1997 21:08:28 GMT
From: "Corporate Microcomputing Department" <sastcm@unx.sas.com>
Subject: Re: Array Elements
Message-Id: <01bc4aa9$c565e8d0$5901170a@spearmint>

You can get the number of elements in an array by using $#arrray if you are
using Perl5
I'm not sure about Perl4, it may be the same. $# returns the last valid
array index.

for example:

	@array_name=(1,2,3,4,5);
	print  "The number of elements is $#array_name\n";

	this will print the number 4.

Tamara 
sastcm@wnt.sas.com 

-----------------------------------------------------------
Gary Chambers <geecee@burbot.netquarters.net> wrote in article
<5j1q11$lpq@noc1.gwi.net>...
> Can someone confirm the correct method of determining the number of
> elements in an array?  I'm *VERY* new to Perl, and I've looked in the
> Camel book and Llama book and found nothing definitive.  Here's what I
> have been able to gather:
> 
> [...]
> $elements = @array;
> print "The number of elements is $elements\n";
> [...]
> 
> Any help is greatly appreciated.
> 
> -- 
> GeeCee/NQ
> 
> // --------------------------------------
> // Gary Chambers <geecee@netquarters.net>
> // NetQuarters, Incorporated
> // --------------------------------------
> 
> 
> 


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

Date: Wed, 16 Apr 1997 16:46:45 -0700
From: 34110s96@student.csi.cuny.edu
Subject: C++Builder means Future.
Message-Id: <335564E5.590F@student.csi.cuny.edu>

I just got C++Builder and I have never seen a powerful RAD tool like
this  one.  Forget about the Visual Crap.  C++Builder is the King of the
Hill and not Marketing hype of Microsoft.  

Any comments are welcome. 
Delphi is the definition of RAD
C++Builder is the future.


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

Date: Wed, 16 Apr 1997 19:15:03 GMT
From: roland@virtual.ch (Roland)
Subject: Re: DNS reverse lookup - gethostbyaddr() - Thanks !
Message-Id: <3355fe52.42305922@news.active.ch>

Klaus Johannes Rusch <e8726057@student.tuwien.ac.at> wrote:
>
>Tested on OS/2, SunOS and AIX:
>
>#!/usr/bin/perl
>
>$remote =3D '193.170.75.14';
>@abcd =3D split (/\./, $remote);
>$adr =3D pack('C4', @abcd);
>($name, $aliases, $addrtype, $length, @addrs) =3D gethostbyaddr($adr,2);
>
>print "$remote is $name\n";
>
>
>Note you will need to have a nameserver (or an entry in your /etc/hosts
>file) and an address that actually resolves to a name.
>
>Klaus Johannes Rusch
>--
>e8726057@student.tuwien.ac.at, KlausRusch@atmedia.net
>http://www.atmedia.net/KlausRusch/

Thanks a lot - works great also on FreeBSD/Apache !
you shure saved me another night...

Roland Schneider
--
http://virtual.ch


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

Date: Wed, 16 Apr 1997 15:43:39 -0400
From: rchannav@transquest.com
Subject: Dynamic scoping with local
Message-Id: <33552BEB.5B8F@transquest.com>

Hi All,

I am having a little difficulty in comprehending the full effect of
Dynamic scoping with a set of local variables viz., side effects.

If someone has a good example (a 5 liner), that can clearly illustrate
the local variable scoping, I appreciate it.

Thanks


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

Date: Wed, 16 Apr 1997 16:50:12 -0500
From: Benjamin Burack <rascal@inlink.com>
Subject: Good editor for W95?
Message-Id: <33554994.60A2@inlink.com>

I'm writing CGI scripts in perl on my W95 machine, and then uploading
them to the Unix server.  I'm looking for recommendations on good
editors that can easily save in a Unix format.

Thanks,
Ben Burack
rascal@inlink.com


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

Date: 16 Apr 1997 22:03:28 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Good editor for W95?
Message-Id: <5j3ibg$5e0$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, rascal@inlink.com writes:
:I'm writing CGI scripts in perl on my W95 machine, and then uploading
:them to the Unix server.  I'm looking for recommendations on good
:editors that can easily save in a Unix format.

vi
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


    "Even egotists are allowed to have opinions." --Larry Wall


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

Date: 16 Apr 1997 16:36:46 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Info about Oraperl
Message-Id: <5j3d8u$eg3$1@tholian.cse.psu.edu>

http://www.dejanews.com/ is the path to enlightenment. There was also an
excellent article in this spring's issue of The Perl Journal
http://www.tpj.com/
John
groenvel@cse.psu.edu 


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

Date: 16 Apr 1997 14:20:24 -0400
From: garrem@rpi.edu (Matt Garretson)
Subject: Input Loop Consumes Resources
Message-Id: <5j3598$1scm@alumni.rpi.edu>

I have the following script:

  #!/usr/local/bin/perl5.003_93 -w
  while (<>) {
     /\.SO (.{0,15})/o && print "$1\n";
  }

When a ~110 MB input file is piped into the above, the process grows in
size until it has consumed the system's free page space (~175 MB) and
then aborts with the "Out of memory!" message.  No output is produced,
although there are matching lines very early in the input file.  The
input file consists of 4096-byte lines of text.  The OS is AIX 3.2.5
with a 200 MB page space on an RS/6000 with 128 MB physical memory.

I tried the above script with perl 5.001 and it also failed in the
same manner, but well before the paging space had been exhausted.

I tried setting $|=1 and even then no output was produced, so my
[admittedly uninformed] intuition tells me that perl is trying to read
through the entire input before executing the script.  True?

Is the above behavior to be expected with large input files?  It's not
like i'm trying to read the whole thing into an array.  Can my script
be modified to behave differently?  I suppose i could increase the
machine's page space, but would like to avoid doing so if possible.

Is there something i could modify in the perl binary that would allow
the use of large input files?  (Output of perl -V is included below.)

Thanks in advance, and i apologize if this is not an appropriate
question for this newsgroup.

-Matt

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

Summary of my perl5 (5.0 patchlevel 3 subversion 93) configuration:
  Platform:
    osname=aix, osvers=3.2.5, archname=aix
    uname='aix host 2 3 000000000000 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio= d_sfio=
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-D_ALL_SOURCE -I/usr/local/include'
    ccflags ='-D_ALL_SOURCE -I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=1, d_casti32=define, d_castneg=
    intsize=4, alignbytes=8, usemymalloc=n, randbits=15
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-ldbm -lld -lm -lc -lbsd -lPW
    libc=/usr/lib/libc.a, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=, ccdlflags='-bE:perl.exp'
    cccdlflags=' ', lddlflags='-H512 -T512 -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -e _nostart -lc -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under aix
  Compiled at Apr  9 1997 12:57:21
  @INC:
    /usr/local/lib/perl5/aix/5.00393
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/aix
    /usr/local/lib/perl5/site_perl



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

Date: Wed, 16 Apr 1997 14:21:12 -0600
From: wh@etc.hansenet.de
Subject: Looking for PERL for the RM400 from SNI (Siemens Nixdorf)...
Message-Id: <861218339.32035@dejanews.com>


Hi,
can anybody help??? I need the PERL-binaries for the
RISC-Machine RM400.
Thanks in advance!
Wolfgang

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 16 Apr 1997 17:04:22 -0500
From: Mike Bartolone 5-4266 <bartolonem@med.ge.com>
Subject: more Re: system(); problem
Message-Id: <33554CE6.794B@med.ge.com>

I got a response on this from Tom Christiansen (thanks much), but
that doesn't seem to help. Tom suggested this:

> Use a list as the documentation directs you:
> 
>     system("$ENV{EXEHOME}/program", $params);
> 
> The program will receive one and only one argument,
> whatever is in $params.  If it's expecting many, use
> 
>     system(split(' ', "$ENV{'EXEHOME'}/program $params"));
> 
> instead.  This will avoid the shell being called.
> 
> And check the return value of system() or the $? variable
> when it's done.
> 
> --tom
>-- End of excerpt from Tom Christiansen

That doesn't seem to work either! It gets even stranger than this. I 
decided to make sure the rest of my environment was not causing the
problem. So, I have the perl script write a shell script for me (I'll
include the code if you want) and then tried to execute that shell
script from within the perl script again using system(). This too fails.
I decided to check the shell script itself, and ran it..it worked. Ok
the shell script is fine. Next I decided to write a shell script wrapper
that would execute the perl script, and then execute the shell script
that it wrote for me..that wrapper script does execute the shell script
which in tern executes the binary in question just fine!

so, this fails:

  perl script executes system call

this fails

  perl writes and executes shell script with system();

this fails

  shell script executes perl, which writes and executes a shell script

this works

  shell script executes perl, which writes a shell script, original
shell script executes new script fine.

I still don't understand why the system() call is not getting the
binary to execute.

Oh, and in all cases, the system call returns a 0.

last item, for the record, I am running:

perl version 4.0, patch level 36 on an SGI running IRIX 5.3


Mike Bartolone 5-4266 wrote:
> 
> parsing. I tried this by calling program like this:
> 
> 
> `$ENV{'EXEHOME'}/program $params`
> system('/usr/3p/bin/program $params');
> 
> So, does anyone know how to get my external program to run from within
> my perl script?
> 

-- 
                            | Keep away from people who try to
Michel Bartolone            | belittle your ambitions. Small people
bartolonem@med.ge.com       | always do that, but the really great
bartolon@execpc.com         | make you feel that you, too, can
                            | become great.        Mark Twain


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

Date: 16 Apr 1997 21:38:59 GMT
From: dnewman@epnet.com (Dave Newman)
Subject: Multiple access to dbm files
Message-Id: <5j3gtj$jv9$1@sparky.epnet.com>

Hi,
	I've looked everywhere and it doesn't seem like anyone
else has this problem.  I have a dbm file that multiple users
need to access at the same time.  I figured that since the users
don't need to update the information that the files could be
opened read only and there wouldn't be a problem.  Perl doesn't
seem to want to let me do this.  If one script has the file
open nobody else can open it.  Is there a way to do this without
useing lock files?  Thanks.

-- 
David Newman
System Administrator
EBSCO Publishing
dnewman@epnet.com


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

Date: Wed, 16 Apr 1997 21:52:19 -0700
From: Gert Frangois <eu000628@eunet.be>
To: Sitel <stefaanc@sitel-be.com>
Subject: Re: Perl & NT & Oracle
Message-Id: <3355AC83.7BEC@eunet.be>

Yes, you have to make an ODBC-connection to Oracle 7 and use the Perl Win32::ODBC functions (and Perl5)

Gert Frangois
Sd-Infotec
Antwerp Belgium


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

Date: Wed, 16 Apr 1997 17:04:03 +0200
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Re: Perl parsing
Message-Id: <3354ea59.0@d2o61.telia.com>

 Jayne Meiners wrote in article <33540245.5632@msp.sc.ti.com>...
>If I am looking for one character out of a string.
>It doesn't matter if it is in the beginning, middle,
>or end. All I want to know is if it exists, what is the parsing
>sequence I need.
>

Hi

Since you dont need to match a pattern, the index() function
might be useful. 

Here is the description about index() from the man perlfunc

  Index STR,SUBSTR
  Returns the position of the first occurrence of SUBSTR in STR at or after
POSITION.  If POSITION is
  omitted, starts searching from the beginning of the string.  The return
value is based at 0 (or
   whatever you've set the $[ variable to--but don't do that).  If the
substring is not found, returns one
  less than the base, ordinarily -1.

I e: 

if (index($mystring, $lonelycharacter) >= 0) {
                           print("The $lonelycharacter exists!\n");
}
   

You could also use a regexp to match it like this:

if ($mystring =~ /$lonelycharacter/) {
  print("The $lonelycharacter exists!\n");
}

Hope this helps

/Fredrik




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

Date: Wed, 16 Apr 1997 05:08:29 -0500
From: Aunt Debi <debi@earthling.net>
Subject: Q:calling perl script into JavaScript?
Message-Id: <3354A51D.6231@earthling.net>

Does anyone know if is possible to define a JavaScript function which
calls a perl or cgi script?

Is it possible to assign a perl script to a JavaScript event handler?

I intend to also post these questions to a JavaScript group, so please
be gentle.  One seeking knowledge never knows from whence it may come.

TIA,

Debi Jones


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

Date: 16 Apr 1997 12:00:54 -0700
From: colink@latticesemi.com (Colin Kuskie)
Subject: Re: Reading another line in an input loop?
Message-Id: <5j37l6$bqj@defiant.latticesemi.com>


In article <334EB7F9.842E23A2@goldinc.com>,
Eric Ladner  <eladner@goldinc.com> wrote:
>I've been over the docs and the FAQ and can't seem to find the answer
>I'm looking for (if it exists at all).
>
>What I want to do is something like this:
[code deleted]  Wants to get another line without looping again

In the perlop man/web page, under the heading of I/O operators:

     Evaluating a filehandle in angle brackets yields the next
     line from that file (newline included, so it's never false
     until end of file, at which time an undefined value is
     returned).  Ordinarily you must assign that value to a
     variable, but there is one situation where an automatic
     assignment happens.  If and ONLY if the input symbol is the
     only thing inside the conditional of a while loop, the value
     is automatically assigned to the variable $_.  The assigned
     value is then tested to see if it is defined.  (This may
     seem like an odd thing to you, but you'll use the construct
     in almost every Perl script you write.)  Anyway, the
     following lines are equivalent to each other:

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

where the interesting part is the first sentence, translated to perl code:

#Evaluating a filehandle in angle brackets yields the next line
$_ = <STDIN>;  ##Grabs the next line, but doesn't check for EOF!!

This is also on page 7 of the Llama and page 2 of the Original Camel.

Good luck, and read carefully next time :)
Colin Kuskie
colink@latticesemi.com


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

Date: 16 Apr 1997 20:00:09 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Reading One Character at a time
Message-Id: <5j3b49$ki0@news-central.tiac.net>

In article <dwaring-1604971035420001@140.107.20.146>,
David Waring <dwaring@fhcrc.org> wrote:
>I'm new to Perl, so forgive me if this question is simple, but I have
>consulted the camel and the llama without finding the answer. I am writing
>a CGI where I receive as one variable, a sequence of characters (it is DNA
>sequence)  I have to check that all the characters are in the set of
>acceptable characters (16 characters).  What is the best way to do this?
>
>As best I can tell I must test each character individually. If I could
>read them into an array it would be easy, but there will be no spaces
>between them and thus no delimiter.

If the characcters are in $string and the legitimate characters are
A .. D and T .. Z (yes I know it's 11 :-) then

  if ($string =~ /^[A-DT-Z]+$/) {
    ...
  }

tests to see that there are one or more of the characters in the ranges
A-D and T-Z and nothing else between the beginning and end of $string.
The ^ and $ represent the beginning and end of the string being ecamined
and [A-DT-Z] is a character class that matches a character in the
specified range and the + means that the pattern needs one or more of the
previous thing (the character class.)  Check out index entries for
patterns or regular expressions in Programming Perl for more detail...

Hope this helps,

Mike

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


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

Date: Wed, 16 Apr 1997 16:35:26 -0400
From: Scott Blanksteen <sib@worldnet.att.net>
Subject: Re: Reading One Character at a time
Message-Id: <3355380E.6579@worldnet.att.net>

David Waring wrote:
> 
> I'm new to Perl, so forgive me if this question is simple, but I have
> consulted the camel and the llama without finding the answer. I am writing
> a CGI where I receive as one variable, a sequence of characters (it is DNA
> sequence)  I have to check that all the characters are in the set of
> acceptable characters (16 characters).  What is the best way to do this?

while (<STDIN>) {
        chomp;
        $badcount = tr/abcdef//c;   # your 16 chars instead of 'abcdef'
   
        if ($badcount) {
                print "Bad character\n";
        }
        else {
                print "Everything's copacetic\n";
        }
}

Scott


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

Date: 16 Apr 1997 20:04:41 +0000
From: Erik Naggum <erik@naggum.no>
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <3070209881177993@naggum.no>

* Charles Lin
| If one had to choose a single type for everything, a string is a pretty
| good choice.  Why not a number?  How would you represent a string with a
| number?

excuse me?  what you call a "string" already _is_ a number.  computers
don't have characters.  display devices and printers do.

one of the first lessons of computer science _should_ have been internal
and external representation are so wildly different concepts that they
cannot even be confused, except, of course, by people who are fully aware
of the difference, but proceed to attempt to obliterate it.

#\Erik
-- 
I'm no longer young enough to know everything.


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

Date: Wed, 16 Apr 1997 13:52:36 -0700
From: "John A. Kaliski" <johnk@krypton.mankato.msus.edu>
Subject: Source code security for Perl 5 on NT (Activeware)
Message-Id: <33553C14.8A7@krypton.mankato.msus.edu>

Hello everyone,

I have produced a PERL 5 on NT using Activeware's Perl.  I am interested
in marketing this system but I do not want to give up the source code
for obivous reasons.  I have read the Perl for Win32 FAQ and it says try
the ShroudIt obfuscator.  I tried it and it seems as though this
obfuscator was not intended for PERL5  (it introduced lots of errors).  
I have also read about using dump & undump but I can not find an undump
for NT.  I have also read about using a filter module to encrypt the
source but this doesn't seem to be available for WIN32 or NT.  Finally
I know that there is a PERL compiler (in Alpha 3) for unix but again it
is not available for NT.  

Does anyone have any other ideas?  Has anyone out there developed a PERL
based system for NT which you are marketing?  If so how did you protect
your source code?

Your input will be GREATLY(!!) appreciated.

Thank you.

John A. Kaliski
johnk@krypton.mankato.msus.edu


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

Date: 16 Apr 1997 20:18:37 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: system(); problem
Message-Id: <5j3c6t$d1$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Mike Bartolone 5-4266 <bartolonem@med.ge.com> writes:
:system("$ENV{'EXEHOME'}/program $params");

Use a list as the documentation directs you:

    system("$ENV{EXEHOME}/program", $params);

The program will receive one and only one argument,
whatever is in $params.  If it's expecting many, use

    system(split(' ', "$ENV{'EXEHOME'}/program $params"));

instead.  This will avoid the shell being called.

And check the return value of system() or the $? variable
when it's done.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

/* This is the one truly awful dwimmer necessary to conflate C and sed. */
    --Larry Wall, from toke.c in the v5.0 perl distribution


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

Date: 16 Apr 1997 19:52:25 GMT
From: kaz@vision.crest.nt.com (Kaz Kylheku)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <5j3alp$out@bcrkh13.bnr.ca>

In article <5j2ljd$q0f@tracy.nacs.net>, Jettero Heller <heller@nacs.net> wrote:
>Tim Behrendsen (tim@a-sis.com) wrote:
>  [in reference to pkzip over tar+gzip]
>: Or how about self-extracting archives?
>
>This concept is utterly useless in un*x. The fact that you bring it
>up indicates that you aren't completely clear on the concept behind
>un*x.

Really? Perhaps you have never heard of shell archive files? ;)

I use the beasties on a regular basis.

I recently prepared UNIX archive that will not only self extract directly off
a tape drive, but also configure itself. That way the customers only have one
command to execute.


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

Date: 17 Apr 1997 08:31:41 +1200
From: physrmh@ANTISPAMphys.canterbury.ac.nz (Ryurick M. Hristev)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <qv6ohbezp3m.fsf@ANTISPAMphys.canterbury.ac.nz>


"Tim Behrendsen" <tim@a-sis.com> writes:

> Don't get me wrong; I use the tar-gzip combination quite often,
> but it's inferior as a tool compared to archive tools, particularly
> in combination with something like WinZip.

Unless you have  to do a  recovery from a  disk crash.  I can throw  2
floppies and start  recovering immediately using a  previously written
script. What do you do ? Start installing  ms win, then install winzip
 ...


Cheers,
-- 
Delete ANTISPAM to reply. Apologies for inconvenience. (Spam,Grrrrr :)
______________________________________________________________________
Ryurick M. Hristev                    ()..()/^\/^\               -<:-)
physrmh@ANTISPAMphys.canterbury.ac.nz   \/ \#/\#/\)    What opinions ?
______________________________________________________________________


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

Date: Wed, 16 Apr 1997 12:22:09 +0000
From: Greg Hassan <gwhassan@prodigy.net>
To: Sascha <ss@ee.ed.ac.uk>
Subject: Re: WANTED: perl guru ;-)
Message-Id: <3354C471.1837FFAA@prodigy.net>

Sascha wrote:
> 
> Hi there!
> 
> I have a perl 5 script which I would like to run as a cgi.
> Unfortunately my system only supports perl 4 so I was wondering if
> someone could be so kind to see whether the script can be rewritten in
> perl 4 or not.
> 

It doesn't look like the script uses anything perl5 specific.
I dont have perl 4 lying around to test it.

It wouldn't be that hard to get this script working but
It is probably best to install perl 5 to insure no more
limitations in the future.  That can be downloaded from perl.com.

You don't seem to use any library functions so you might 
get away with just installing the perl binary in your 
directory.  Then your cgi can just use that version of 
perl instead of the main system's perl.  

-Greg

-- 
============================================
                Greg Hassan
          The Independent Solution
 Web Developer (CGI, Java, C, Perl, Oracle)
           http://www.hassan.com/        
    gwhassan@prodigy.net, 1-415-969-5856
============================================


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

Date: Wed, 16 Apr 1997 17:26:30 -0400
From: "Dean Z. Douthat" <dean@cyberzone-inc.com>
Subject: Re: What does "UNIX" stand for..
Message-Id: <33554406.66E@cyberzone-inc.com>

gerv wrote:

Thanks for reposting this classic.  I had lost my copy.
-- 
Dean Z. Douthat
Osiris Business Systems
PO Box 7571 Ann Arbor MI  48107-7571
(313)747-9170


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

Date: 16 Apr 1997 15:44:33 -0400
From: mkc@flea.nexen.com (Mark Culotta)
Subject: Re: Who makes more $$ - Windows vs. Unix programmers?
Message-Id: <tr7k9m2oiqm.fsf@flea.nexen.com>


Leslie Mikesell wrote:
> Kaz Kylheku <kaz@vision.crest.nt.com> wrote:
> > Someone else wrote:
> > >  Unix is what it is ... a ``UNIfied eXecutive'' -- an so it should
> > >  be understood ... Amen! But if you wish, go fondeling your FAQ ...
> >
> > Sorry, your silly insistence that UNIX stands for ``UNIfied eXecutive'' (ha ha)
> > doesn't make it so.
> >
> > The fact that UNIX is a pun on Multics is no urban legend, but a simple
> > historic fact. If you don't believe Lawrence Kirby, please write mail to
> > Brian Kernighan.
> 
> Doesn't the term 'pun' imply that you can infer multiple meanings?  A
> UNIfied eXecutive is a good description of unix.  If you accept the
> concept that an operating system can be simplified to the point that
> it only needs one way of creating a new process (duplicating an
> existing process) and that the newly created process should take
> care of any additional transformations it needs then the rest of
> the unix design just falls into place.

UNIfied eXecutive is not necessarily a good description of Unix,
anymore than any other OS.  There have been several versions of Unix
based on microkernels such as Mach.  The Next box was one such.  In
fact, I can't think of any Mach distributions that weren't essentially
BSD4.3 Unix on top of the microkernel which was the case with Next.

The fact that Unix is really a philosophy that processes are cheap and
everything is a file more of less, as opposed to, say, VMS where any
programs you run are executed in the same process as your login DCL
and having the output of a command be put in a file is a special
command line option, doesn't imply anything about how the kernel is
structured. 

Mark Culotta
-- 
--
________________________________________________________________________
Mark K. Culotta                                            mkc@nexen.com
Ascom Nexion     289 Great Rd., Acton MA 01720 USA       +1 508 266-2355


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

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

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