[6504] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 129 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 17 00:07:19 1997

Date: Sun, 16 Mar 97 21:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 16 Mar 1997     Volume: 8 Number: 129

Today's topics:
     Re: [HELP] !@#$% sort subroutines... <vladimir@cs.ualberta.ca>
     [Q]Manipulating hash values <darrylc@eznet.com>
     Re: [Q]Manipulating hash values (Tad McClellan)
     Help needed with time and Perl <gooseman@mindspring.com>
     Re: Help needed with time and Perl (Tad McClellan)
     Re: help setting documentroot expression (Tad McClellan)
     How do I make the <STDIN> invisible? (Your Name)
     Re: How do I make the <STDIN> invisible? <tchrist@mox.perl.com>
     IEEE arithmetic and exceptions <walton@frontiernet.net>
     Re: keys from nested data structures -- is there an eas <billc@tibinc.com>
     Min (or Max) function? Is there such a beast? <John.Adams@BentonvilleAR.ncr.com>
     Re: Min (or Max) function? Is there such a beast? <billc@tibinc.com>
     Re: perl and C++ <walton@frontiernet.net>
     Perl and MUDs <wade@cs.ualberta.ca>
     Re: Perl on Windows 95 <tojo@ird.jri.co.jp>
     Re: Perl-style regular expressions for C/C++? <fishbowl@fotd.netcomi.com>
     Re: Perl5.003 for SCO?? (William M. Perry)
     Re: PERLDatabase broken!Need help! (Tad McClellan)
     simple glob fails under Linux (Sussex Silversmiths)
     Re: T: Extracting the file owner, get time in milisecon <billc@tibinc.com>
     Re: utmp/wtmp under Perl (Danny Aldham)
     Why does string comparison use signed chars? <vladimir@cs.ualberta.ca>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 16 Mar 1997 21:36:35 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Subject: Re: [HELP] !@#$% sort subroutines...
Message-Id: <omybbn16ek.fsf@tees.cs.ualberta.ca>

In article <Pine.GSO.3.95q.970314192555.11801F-100000@linda.teleport.com> Tom Phoenix <rootbeer@teleport.com> writes:

> Start with '0..$#_'. That's a list of the indices of the @_ array.

Hey, shouldn't this be 0..$#_-1 ? We novices already have hard enough time
with perl :-)


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

Date: 16 Mar 1997 07:23:04 GMT
From: Darryl Caldwell <darrylc@eznet.com>
Subject: [Q]Manipulating hash values
Message-Id: <5gg74o$66p$1@pepper.eznet.com>

Nature of hashes?

I've created a hash that gives me the following output:

key			value
--- 			-----
99205			5
80832			1
99229 		1
83816 		2
99004			1
99006 		8

and so on. Is there a way (via array or hash) to add the values of the
keys with matching first 3 digits into one amount? For example:

key		value
--- 	-----
992		6
808 	1
838 	2
990 	9

Thanks in advance.

Darryl Caldwell


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

Date: Sun, 16 Mar 1997 22:16:35 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: [Q]Manipulating hash values
Message-Id: <3jgig5.ao1.ln@localhost>

Darryl Caldwell (darrylc@eznet.com) wrote:

: Nature of hashes?
  ^^^^^^^^^^^^^^^^^

I don't think I understand what you are asking with that one.

Is it a rhetorical question?

Anyway...


: I've created a hash that gives me the following output:

: key			value
: --- 			-----
: 99205			5
: 80832			1
: 99229 		1
: 83816 		2
: 99004			1
: 99006 		8

: and so on. Is there a way (via array or hash) to add the values of the
             ^^^^^^^^^^^^^^

Yes. It is only a SMOP...


: keys with matching first 3 digits into one amount? For example:

: key		value
: --- 	-----
: 992		6
: 808 	1
: 838 	2
: 990 	9


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

%hash = qw(
99205 5
80832 1
99229 1
83816 2
99004 1
99006 8
);

foreach (keys %hash) {
   if (/^(\d{3})/) {
      if (defined($sum{$1}))        # all subsequent ones
         {$sum{$1} += $hash{$_}}
      else                          # first one
         {$sum{$1} = $hash{$_}}
   }
   else
      {print "Huh? key does not start with three digits!\n"}
}

foreach (sort {$a <=> $b} keys %sum) {
   printf "%8d  %8d\n", $_, $sum{$_};
}
---------------------


: Thanks in advance.

You're welcome.


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


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

Date: Sun, 16 Mar 1997 21:24:26 -0800
From: Chris Burge <gooseman@mindspring.com>
Subject: Help needed with time and Perl
Message-Id: <332CD58A.4E79@mindspring.com>

I'm trying to develop a Perl script that will allow me to basiclly
change links in my page according to the time of day it is.

For example....


It is 12 noon, picture A is displayed on the page.  At 2 pm, picture A
is replaced with picture B. and such forth...


Thanks,

Chris Burge


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

Date: Sun, 16 Mar 1997 22:24:38 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help needed with time and Perl
Message-Id: <62hig5.to1.ln@localhost>

Chris Burge (gooseman@mindspring.com) wrote:
: I'm trying to develop a Perl script that will allow me to basiclly
: change links in my page according to the time of day it is.

: For example....

: It is 12 noon, picture A is displayed on the page.  At 2 pm, picture A
: is replaced with picture B. and such forth...


OK. 

Is there a perl question in there somewhere?

(like: "how do you tell what time it is?" or "how do I substitute
 for some links?")

Or are you asking us to write the program for you?

Or did your posting get truncated or something?


It's probably that last one, so, just repost with the code you
have so far, and what it does, and what you _want_ it to do,
and we'll try and help...


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


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

Date: Sun, 16 Mar 1997 21:10:01 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: help setting documentroot expression
Message-Id: <9mcig5.ke1.ln@localhost>

Ken Gaugler (keng@wco.com) wrote:
: I am trying to modify a script from one of the O'Reilly books which
: has the following line:

: $document_root = $ENV{'DOCUMENT_ROOT'};

: I would like '$document_root' to point to a directory called 'bb' which
: is just below the server's real document root.  That is, as the script
: evaluates the expression now, it points to '/var/web/webspace', and
: I would like it to point to '/var/web/webspace/bb' instead.  Can someone
: show me the correct way to do this?


$document_root = $ENV{'DOCUMENT_ROOT'} . "/bb";

OR

$document_root = "$ENV{'DOCUMENT_ROOT'}/bb";


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


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

Date: Sun, 16 Mar 1997 18:28:34 -0800
From: username@teleport.com (Your Name)
Subject: How do I make the <STDIN> invisible?
Message-Id: <username-1603971828340001@ip-pdx15-29.teleport.com>

I want to have some sort of password thing, and I want the input to be invisble.

For example,

print 'Login: ';
$login = <STDIN>;
chop $login;

print "\nPassword: ";
$password = <STDIN>;
chop $password;



Is there something I use instead of <STDIN>?  I don't want them to see the
password, but I do want them to see the login.

Also:

How many different $ENVs are there when you get info from another computer?

AJ Murray
ajmurray@teleport.com


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

Date: 17 Mar 1997 03:23:21 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How do I make the <STDIN> invisible?
Message-Id: <5gidf9$h5d$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email, but
  only because I worked hard at it.  It was otherwise broken.]

In comp.lang.perl.misc, ajmurray@teleport.com (Your Name) writes:
:I want to have some sort of password thing, and I want the input to be invisble.
:
:For example,
:
:print 'Login: ';
:$login = <STDIN>;
:chop $login;
:
:print "\nPassword: ";
:$password = <STDIN>;
:chop $password;

>From the FAQ, part 7:

Q:  How do I ask the user for a password?

A:  There's an example of this in the "crypt" entry in the perlfunc
    manpage). First, you put the terminal into "no echo" mode, then just
    read the password normally. You may do this with an old-style ioctl()
    function, POSIX terminal control (see the POSIX manpage, and Chapter
    7 of the Camel), or a call to the stty program, with varying degrees
    of portability.

    You can also do this for most systems using the Term::ReadKey module
    from CPAN, which is easier to use and in theory more portable.

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

    Perl programming is an *empirical* science!  
	    --Larry Wall in <10226@jpl-devvax.JPL.NASA.GOV>


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

Date: Sun, 16 Mar 1997 22:10:54 -0500
From: Bob Walton <walton@frontiernet.net>
Subject: IEEE arithmetic and exceptions
Message-Id: <332CB63E.577B@frontiernet.net>

I was recently attempting to port some hairy numeric code to
Perl (currently operational on Matlab, Java, JavaScript, Excel,
and Lotus).  This code takes advantage of the IEEE "Inf" and
"NaN" values to ascertain when input variables are in
"infeasible" ranges.  

I note that Perl generates fatal error messages on things
like 1/0 and sqrt(-1), rather than returning Inf or NaN
values, even on machines with hardware IEEE arithmetic support.  
Putting in checks around each and every division, sqrt, etc is 
a big and potentially error-prone task, especially to generate 
the desired behavior which is identical with what IEEE standard
arithmetic gives.  I have read all the man pages, the Camel book,
and the FAQ, all without finding a solution to this.  I
know that enclosing expressions with an "eval" will get
rid of the fatal error, and will return an "undef" for 
the entire expression.  But the "undef" is later interpreted
as a zero, and does not propagate, which will make my code
give wrong answers.  I see the FAQ mentions an "idea" for a 
future IEEE module.

Is there any way of getting Perl to generate Inf and NaN
values and suppress the error messages for division by zero
and domain errors in built-in functions?  Thank you.


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

Date: Sun, 16 Mar 1997 20:58:28 -0500
From: Bill Cowan <billc@tibinc.com>
To: htaylor@mit.edu
Subject: Re: keys from nested data structures -- is there an easy way?
Message-Id: <332CA544.5ADB@tibinc.com>

Hank Taylor wrote:
> 
> i've just begun to use perl's "complex data structures" so pardon me if
> this is a silly question.
> 
> i want to get the all sets of keys from a multi-dimensional hash. here's
> an example of the problem. the hash looks something like this:
> 
>         $hash{$outerkey}{$innerkey}.
> 
> the set of outer keys is easy:
> 
>         @outer_keys = keys %hash;
> 
> the *complete* set of inner keys is more problematic for me. the only
> way that i've been able to do it is to loop over all the outer keys and
> construct an array of unique keys for the keys in every sub-hash (eg.
> each of the %{$hash{$outerkey}} values). here's my novice attempt at key
> extraction...
> 
> ----------------------------------------------------------------------------
> foreach $o_key (keys %hash) {
>         foreach $i_key (keys %{$hash{$o_key}}) {
>                 unless (grep(/$i_key/, @i_key)) {push(@i_key, $i_key)}
>         }
> }
> ----------------------------------------------------------------------------
> 
> tell me that there's an easier way! also, what about the keys for:
> 
>         $hash{$outerkey}...{$innerkey}?
> 
> please reply to htaylor@mit.edu and post to news if you think it's
> worthwhile for the group to hear about this question.
> 
> thanks in advance for the help!
> 
> hank taylor
> htaylor@mit.edu

You could simplify your code by using values() in the outer foreach loop
to get list of references to the inner hash keys. Below is another way
that uses map function (in lieu of foreach loops) and different way to
remove duplicates.

------------------------- Code sample --------------------------------
my %hash;
$hash{outer1}{inner1} = '';
$hash{outer1}{inner2} = '';
$hash{outer1}{inner3} = '';
$hash{outer2}{inner1} = '';
$hash{outer2}{inner2} = '';
$hash{outer2}{inner4} = '';
$hash{outer3}{inner5} = '';
$hash{outer3}{inner2} = '';

#-- Get list of hash references to "inner" hash keys;
#-- this eliminates need to get keys() at outer level.
@ListOfHashRef = values %hash;

#-- Get hash keys for each hash ref in the list.
#-- Another shorter way:  @AllInnerKeys = map(keys(%{$_}), values
%hash);
@AllInnerKeys = map(keys(%{$_}), @ListOfHashRef);

#-- Remove duplicate entries from an array with temp hash
#-- or whatever method you prefer.
my %TmpHash = ();
@UniqueKeys = grep( ( (++$TmpHash{$_} == 1) || 0 ), @AllInnerKeys);

print join(',', @UniqueKeys), "\n";

---------------------- Output ---------------------------------------
inner1,inner2,inner3,inner4,inner5

-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com>    Voice:919-490-0034   Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707


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

Date: Mon, 17 Mar 1997 00:18:29 GMT
From: John Adams <John.Adams@BentonvilleAR.ncr.com>
Subject: Min (or Max) function? Is there such a beast?
Message-Id: <332C8DD5.2716@BentonvilleAR.ncr.com>

 ...couldn't find it in the FAQ, or the llama book (though I did find Max 
Headroom)...

John Adams
BentonvilleAR
NCR

 ...I think you know where to put a dot, an at, a dot, another dot, and 
then a (com)...


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

Date: Sun, 16 Mar 1997 22:01:52 -0500
From: Bill Cowan <billc@tibinc.com>
To: John Adams <John.Adams@BentonvilleAR.ncr.com>
Subject: Re: Min (or Max) function? Is there such a beast?
Message-Id: <332CB420.6263@tibinc.com>

John Adams wrote:
> 
> ...couldn't find it in the FAQ, or the llama book (though I did find Max
> Headroom)...
> 
> John Adams
> BentonvilleAR
> NCR

I assume you mean "min/max for an array".

Min or Max function is not built-in to Perl. Because an array may
contain numbers and/or strings (or dates represented as strings), you do
not know   the datatype so you can not make the proper comparison. 

Please see doc about sort() about sorting strings versus numbers. And as
simple basis to write your own min/max funcition on the sorted result. 

-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com>    Voice:919-490-0034   Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707


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

Date: Sun, 16 Mar 1997 22:29:38 -0500
From: Bob Walton <walton@frontiernet.net>
To: root <William.Gacquer@obspm.fr>
Subject: Re: perl and C++
Message-Id: <332CBAA2.61E8@frontiernet.net>

Root, for your particular task, the Perl code won't differ
significantly from the corresponding C++ code (except you'll
have to manage the memory yourself in C++).  You will probably be 
better off to just write it in C++ and avoid the hassle of 
interfacing.  Then you can try Perl later for something it would be 
a little better at, like pattern matching, indexing things by 
strings, etc.  But if you insist, look at the "perlcall" man page.  
It walks you through the interface in detail, complete with 
examples.

root wrote:
> 
> Hi!
>         I am just starting learning perl. I plan to do
> a simple program and I wonder if I still have to use C/C++
> (As I ever do) to do this or if I can use perl in my C++ code.
[...]


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

Date: 16 Mar 1997 18:53:26 -0700
From: Wade Holst <wade@cs.ualberta.ca>
Subject: Perl and MUDs
Message-Id: <r7endf473d.fsf@sunchild.cs.ualberta.ca>


I am doing research in the area of programming languages, and have only
recently explored the whole Mud/Mush/MOO/etc/etc. paradigm.  I have
experimented with the LambdaMOO programming language, and find it rather
limited.  As well, the database persistency model represented by Mud Servers
(i.e. LambdaMOO) could be improved (for example, with the concept of
transient objects vs. persistent objects, and various other features designed
to improve performance.

I was wondering if there are any individuals currently looking into using
Perl as the programming language for a new type of Multiple-User-Dimension.
I'd be interested in contributing to such a venture.


Wade Holst







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

Date: Tue, 11 Mar 1997 14:28:04 +0900
From: Takeshi Tojo <tojo@ird.jri.co.jp>
Subject: Re: Perl on Windows 95
Message-Id: <3324ED64.7EF0@ird.jri.co.jp>

Try ".pl   c:\perl5\bin\perl.exe %s %s"

> I have Perl5.003 and pws1.0 - and also associated .pl with
> c:\perl5\bin\perl.exe, and in the registry added an entry
> ".pl   c:\perl5\bin\perl.exe" (as suggested in one of the dejanews
> articles) but still no luck...

-- 
Takeshi Tojo / The Japan Research Institute, Ltd.


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

Date: Sun, 16 Mar 1997 20:17:20 -0600
From: "James L. McGill" <fishbowl@fotd.netcomi.com>
To: "Jagadeesh K. Venugopal" <jvenu@ctp.com>
Subject: Re: Perl-style regular expressions for C/C++?
Message-Id: <Pine.LNX.3.95.970316201402.22550C-100000@fotd.netcomi.com>

>it actually talks of Regexes in a platform independent manner and
>then tackes some important platforms including Perl, tcl and GNU
>emacs. I did not see a description of any C/C++ Regex library.

Bummer.  I have had little difficulty learning the regexp concept from
a sed/awk/perl point of view.  But the documentation of the regex library
is difficult at best, even for me.  I have the book now, and I have found
some very interesting points in there.  I'm really glad I have it, but
as far as actually making use of the C regex calls, I do not see the light
at the end of the tunnel for want of an introduction to the documentation,
or maybe a few easy to understand examples.

--
g-r-a-t-e-f-u-l-l-y---[   email:<fishbowl@conservatory.com>   ]---l-i-v-i-n-g
d-e-a-d-i-c-a-t-e-d---[ http://www.conservatory.com/~fishbowl ]-----l-i-g-h-t



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

Date: 14 Mar 1997 13:45:23 -0800
From: wmperry@aventail.com (William M. Perry)
Subject: Re: Perl5.003 for SCO??
Message-Id: <86hgie407g.fsf@kramer.in.aventail.com>

greg@geographe.com.au (Greg Wake) writes:

> Has anyone got Perl5.003 working with SCO OpenServer 5??
> 
> Specifically I would like to get the Dynamic Loading working.
> 
> Any pointers appreciated.

  I have gotten it working with a bit of hacking (requires using GCC right
now, haven't quite got the flags right for using SCO cc).  A few hacks to
the Configure script to tell it to build a dynamic libperl*.so and all is
well with the world.  I can send you my Configure script if you want, or
diffs, or whatever.

  I don't really have time to fix up real patches to whatever generated the
Configure script (I'm an autoconf kind of guy myself).  If anybody wants
to, please send me mail.

  With this setup, I'm able to use Perl/Tk and load up 5 or 6 different
modules I've written myself with no problem whatsoever.

-Bill p.
-- 
William Perry			wmperry@aventail.com
Unix Server Development Lead  & Emacs-W3 Author
Aventail, Corp.			http://www.aventail.com


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

Date: Sun, 16 Mar 1997 22:17:34 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: PERLDatabase broken!Need help!
Message-Id: <ukgig5.ao1.ln@localhost>

revjack@radix.net (revjack@radix.net) wrote:
: Previously, Odin at Pacific Bell Internet Services wrote:

: : <HTML><BODY>

: Dear God.


Forgive them God, for they know not what they do...


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


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

Date: Mon, 17 Mar 97 04:22:06 GMT
From: sussex@interlog.com (Sussex Silversmiths)
Subject: simple glob fails under Linux
Message-Id: <5gih2m$c9k@news.interlog.com>
Keywords: perl linux glob bug

I can't get directory globbing to work under the August 96 slackware 
distribution of Linux 2.0, Perl 5.003.  The following expression yields no 
output in a rather full directory:

 while(<*>){print "name: $_ \n";}

echo * works in the shell (bash) and when run from perl as:
 open(FOO, "echo * ... while(<FOO>) ...

and readdir works properly, so I can work around this.  The program using the 
globbing works properly on a BSD system I tried.  What needs to be upgraded? 
Linux or Perl or both.  

Thank You,

Peter Wooster

sussex@interlog.com  
 


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

Date: Sun, 16 Mar 1997 21:27:56 -0500
From: Bill Cowan <billc@tibinc.com>
To: mambaum@xs4all.nl
Subject: Re: T: Extracting the file owner, get time in miliseconds
Message-Id: <332CAC2C.352E@tibinc.com>

Martin Ambaum wrote:
> 
> I am using NT4.0/MIIS3.0 ASP with perlis.dll
> 
> Does anybody know:
> 
> 1. Is there a method to extract the owner of file ?
> 
> 2. If I use the time functions in perl under NT I get the time rounded
>    to full seconds, but I would like to have miliseconds, to be able
>    to clock the times the scripts need to be executed.
>    Is there a method to do so ?
> 
> Thanks... :-)

If no other response, please check the following; I think your second
question was covered for NT specific solution.

Searchable Archive for Perl-Win32-users Mailing List:
    http://www.divinf.it/perl-win32/index.sht

Evangelo's Frequently Asked Questions (FAQ):
    http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html

-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com>    Voice:919-490-0034   Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707


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

Date: 15 Mar 1997 09:14:14 -0800
From: danny@hendrix.postino.com (Danny Aldham)
Subject: Re: utmp/wtmp under Perl
Message-Id: <5geld6$6sa@hendrix.postino.com>

John Goerzen (jgoerzen@complete.org) wrote:

: How do I access the system's wtmp (or utmp) database from Perl?  Under C, I
: would use getutent() and utmpname().  I cannot seem to find any equivolent
: function under Perl.

The toughest part is that every vendor seems to pack them differently.
Take a look in your types.h and utmp.h files to see how they are packed.
Then you can do something like, 

#!/usr/bin/perl 

open(UTMP,'/etc/utmp');
while (read(UTMP,$utmp,36)) {
    ($line,$name,$host,$time) = unpack('A8A4A12l',$utmp); # to unpack SCO unix
    }
}   
close UTMP ;
--
Danny Aldham       www.postino.com
Need a UUCP E-Mail feed? - Ask me!
Dial-up access in British Columbia. TCP access around the World.


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

Date: 16 Mar 1997 21:14:01 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Subject: Why does string comparison use signed chars?
Message-Id: <omzpw317g6.fsf@tees.cs.ualberta.ca>

Is there any particular reason string comparison (cmp, lt, le, etc) uses
signed chars? I'm manipulating a dictionary and I want '.' to collate before
any letter (as is customary). However, it contains some foreign letters with
8-bit set, and it thinks these come eralier than '.'. Is there a way to tune
cmp etc?

And some really novice questions. I have come up with some solutions, but they
seem unnatural/inefficient:

task: tr/$foo/$bar/;
soln: eval "tr/$foo/$bar/";

task: tr a string so that every letter from @src is replaced with the
      corresponding string in @$trg. Think the Russian letter shch.
soln: for $i (0..length($src)-1) {
        $c = substr($str,$i,1);   # there's got to be a better way!
        $out .= ($j=index($src,$c))>=0 ? $trg->[$j] : $c;
      }

task: find out if $str is in @array
soln: should I make an inverse %array that maps every element to its index?

Please CC any replies to me.
TIA, Vlad


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

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

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