[11396] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4997 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 26 16:17:52 1999

Date: Fri, 26 Feb 99 13:14:56 -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           Fri, 26 Feb 1999     Volume: 8 Number: 4997

Today's topics:
        really dumb question about arrays <webmaster@provence-shop.com>
    Re: really dumb question about arrays <wayne.izatt@myself.com>
    Re: really dumb question about arrays <kprice@cardinal.co.nz>
        Recent reviews: February postings to Ed's Internet Book <bell@clark.net>
        Redirecting to a password protected page <DblClick@inter.net.il>
        Redirecting to a password protected page <DblClick@inter.net.il>
    Re: Redirecting to a password protected page <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Redirecting to a password protected page <smiles@wfubmc.edu>
    Re: Redirecting to a password protected page <hunt@queen.es.hac.com>
    Re: Redirecting to a password protected page (Ronald J Kimball)
    Re: Redirecting to a password protected page <DblClick@inter.net.il>
        referer() for security? <joe_t@joe10.com>
    Re: referer() for security? (brian d foy)
    Re: referer() for security? <tchrist@mox.perl.com>
        Refreshing Popup_Menu <scijr@nus.edu.sg>
    Re: Refreshing Popup_Menu (Bill Moseley)
    Re: Regular expression for Currency ??? <monty@primenet.com>
        Regular Expressions <curweb@cur.org>
    Re: Regular Expressions <vamp71@freemail.gr>
    Re: Regular Expressions <Tony.Curtis+usenet@vcpc.univie.ac.at>
        remote nt servers <robichag@nt.com>
        Remove a specific member of an array <r2-d2@REMOVEbigfoot.com>
    Re: Remove a specific member of an array (Bill Moseley)
    Re: Remove a specific member of an array (Larry Rosler)
    Re: Remove a specific member of an array (Larry Rosler)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 22 Feb 1999 18:43:48 -0500
From: Lionel ANDRE <webmaster@provence-shop.com>
Subject: really dumb question about arrays
Message-Id: <36D1EBB4.97E90057@provence-shop.com>

Hi, 

I have an asociative array that is made like this (or at least, it
should be!): name1::value1&name2::value2&...&namen::valuen.  

But when I transfer the content of %myhash into @myarray by typing :
@myarray = %myhash to split the name / value pairs, my array looks like
this: name1 value1 name2 value2 ... namen valuen. 

any idea why this is like this, or anything I am doing wrong??? 

I tried @myarray eq %myhash but @myarray is now empty. 

Oh, two last things:
1- I am completely new to PERl, i mean that i am slowly discovering
this! 
2- I am using matt Wright's cookie.lib to retrieve compressed cookies,
hence the & :: type of separation. 

Thank you for your help nd time. 

Lionel Andre


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

Date: Mon, 22 Feb 1999 22:48:33 -0800
From: Wayne Izatt <wayne.izatt@myself.com>
Subject: Re: really dumb question about arrays
Message-Id: <36D24F40.939DBEC@myself.com>

Perl is doing what it does best - making some sort of sense of your code
(and in this case creating a list out of your hash). What I suspect you
wanted was an array consisting of all the values in your hash: this can be
achieved very easily by

@myarray = values %myhash;

Incidentally, a similar array of key values can be created by

@mykeyarray = keys %myhash;

cheers

Lionel ANDRE wrote:

> Hi,
>
> I have an asociative array that is made like this (or at least, it
> should be!): name1::value1&name2::value2&...&namen::valuen.
>
> But when I transfer the content of %myhash into @myarray by typing :
> @myarray = %myhash to split the name / value pairs, my array looks like
> this: name1 value1 name2 value2 ... namen valuen.
>
> any idea why this is like this, or anything I am doing wrong???
>
> I tried @myarray eq %myhash but @myarray is now empty.
>
> Oh, two last things:
> 1- I am completely new to PERl, i mean that i am slowly discovering
> this!
> 2- I am using matt Wright's cookie.lib to retrieve compressed cookies,
> hence the & :: type of separation.
>
> Thank you for your help nd time.
>
> Lionel Andre



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

Date: Tue, 23 Feb 1999 13:54:23 +1300
From: Kelvin Price <kprice@cardinal.co.nz>
Subject: Re: really dumb question about arrays
Message-Id: <36D1FC3F.40ED5220@cardinal.co.nz>

Lionel ANDRE wrote:
> 
> Hi,
> 
> I have an asociative array that is made like this (or at least, it
> should be!): name1::value1&name2::value2&...&namen::valuen.
> 
> But when I transfer the content of %myhash into @myarray by typing :
> @myarray = %myhash to split the name / value pairs, my array looks like
> this: name1 value1 name2 value2 ... namen valuen.
> 
> any idea why this is like this, or anything I am doing wrong???
> 
> I tried @myarray eq %myhash but @myarray is now empty.
> 

It's doing what you asked it to do, what do you want it to do ??
You can use the values command to get just a list of values (keys for
keys).  Please explain clearly what you want and you will either help
yourself or enable a c.l.p.m contributor to help you.


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

Date: Fri, 26 Feb 1999 06:23:23 -0500
From: "Dr. Edwin V. Bell, II" <bell@clark.net>
Subject: Recent reviews: February postings to Ed's Internet Book Review
Message-Id: <36D68422.49DC15B5@clark.net>

        This posting summarizes the reviews which were published in
        February, 24 in all. EIBR also welcomes new contributor
        Erin Peterson.

        Coming in March will be even more reviews, including:
        A Cavern of Black Ice by J. V. Jones (Fantasy and Science
        Fiction); Perl in a Nutshell by Ellen Siever et al. (Computer);
        and Hard Christmas by Barbara D'Amato and Sand Dollars by
        Charles Knief (Mystery). There will be more, too. Hope
        you enjoy the reviews and keep reading!


                                    Computer
          Author                      Title               Reviewer
        Vicki Brown and    MacPerl: Power and Ease        E. V. Bell, II
          Chris Nandor
        Karl Moss          Java Servlets                  E. V. Bell, II


                          Fantasy and Science Fiction
          Author                      Title               Reviewer
        Edgar Rice         A Princess of Mars             E. V. Bell, II
          Burroughs
        L. E. Modesitt,    Colors of Chaos                E. V. Bell, II
          Jr.


                                General Fiction
          Author                      Title               Reviewer
        Tom Robbins        Half Asleep in Frog Pajamas    Karen A. Bornstein
        Tom Robbins        Jitterbug Perfume              Karen A. Bornstein


                            Mystery/Thriller/Suspense
          Author                      Title               Reviewer
        Ace Atkins         Crossroad Blues                Maddy Van
                                                            Hertbruggen
        Jen Banbury        Like a Hole in the Head        Maddy Van
                                                            Hertbruggen
        Susan Rogers       Hickory Dickory Stalk          Maddy Van
          Cooper                                            Hertbruggen
        Alan Beechey       An Embarrassment of Corpses    Maddy Van
                                                            Hertbruggen
        Monica Ferris      Crewel World                   Carl Brookins
        Kinky Friedman     The Love Song of J. Edgar      E. V. Bell, II
                             Hoover
        Nicola Furlong     A Hemorrhaging of Souls        Carl Brookins
        John Grisham       The Street Lawyer              Erin Peterson
        Karen Harper       The Poyson Garden              Lesa Holstine
        Carolyn G. Hart    Yankee Doodle Dead             P. K. Falk
        J. A. Jance        Minor in Possession            E. V. Bell, II
        Faye Kellerman     Prayers for the Dead           Maddy Van
                                                            Hertbruggen
        Laurie R. King     A Monstrous Regiment of Women  Maddy Van
                                                            Hertbruggen
        Martha C. Lawrence The Cold Heart of Capricorn    Carl Brookins
        Peter Lovesey      Diamond Solitaire              Maddy Van
                                                            Hertbruggen
        Leslie O'Kane      The Cold Hard Fax              E. V. Bell, II
        S. J. Rozan        China Trade                    Carl Brookins
        Kathy Hogan        Lickety-Split                  Maddy Van
          Trocheck                                          Hertbruggen


        Over 1,200 reviews in two dozen genres plus interviews and
        editorials. Ed's Internet Book Review: no one else gives you
        such honest reviews. The only URL you need is:

            http://www.clark.net/~bell/eibr/

        (Save yourself hundreds of wasted keystrokes...bookmark it!)


        Wanna be a jet setter? A sex magnet? A world-class olympic
        athlete? Well, I can't do anything for you there. But you can
        be a reviewer for EIBR! Details are available on the site.

                                                        Ed
-- 
__________________________________________________________
   ____  _____   ___    ___
  /        /    /   )  /   )
 /---     /    /---   /---
/____  __/__  /____) /    \
Ed's  Internet Book  Review
http://www.clark.net/~bell/eibr/
__________________________________________________________
Ed Bell
bell@clark.net
http://www.clark.net/~bell/


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

Date: Wed, 24 Feb 1999 20:34:36 -0000
From: "Tomer Kalev" <DblClick@inter.net.il>
Subject: Redirecting to a password protected page
Message-Id: <7b1gq9$8uc$1@news.netvision.net.il>

I need to redirect a user to a password protected page, that is usually
accessed through a login screen.
How can I post the login info, as if the user surfed through the login
screen, and filled in the login form? I don't want the user to see the
password.

Thanx,
Tomer.





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

Date: Thu, 25 Feb 1999 07:34:49 -0000
From: "Tomer Kalev" <DblClick@inter.net.il>
Subject: Redirecting to a password protected page
Message-Id: <7b2ng9$dsb$1@news.netvision.net.il>

I need to redirect a user to a password protected page, that is usually
accessed through a login screen.
How can I post the login info, as if the user surfed through the login
screen, and filled in the login form? I don't want the user to see the
password.

Thanx,
Tomer.





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

Date: 24 Feb 1999 20:54:06 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Redirecting to a password protected page
Message-Id: <83emnf1std.fsf@vcpc.univie.ac.at>

Re: Redirecting to a password protected page, Tomer
<DblClick@inter.net.il> said:

Tomer> I need to redirect a user to a password
Tomer> protected page, that is usually accessed
Tomer> through a login screen.  How can I post the
Tomer> login info, as if the user surfed through the
Tomer> login screen, and filled in the login form? I
Tomer> don't want the user to see the password.

and the relevance to perl is ... ?

-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Tue, 23 Feb 1999 17:39:40 -0500
From: Steve Miles <smiles@wfubmc.edu>
Subject: Re: Redirecting to a password protected page
Message-Id: <36D32E2C.399092EF@wfubmc.edu>

I've been trying to work out something like this for a while. I originally
had the user login, check to see if the password is OK via Perl, then
redirect them to the password protected page by using an url in this
format:

username:password@yoursite.com/protected/here

This actually works with .htaccess if you type it in the browser, BUT, in a
cgi script it works fine with Netscape but in IE4 it prompts the user for
the .htaccess password - what we don't want.

THERE IS ANOTHER WAY AROUND THIS, that I though of, but haven't tried yet,
and that is to redirect the user to a page that has a "meta - refresh" tag
were they are forwarded to username:password@yoursite.com/protected/here.
Might work smoothly in both browsers. If you figure out a way to do this,
let me know!

Would be great because then you can monitor access to your site via the cgi
script logins rather than have to monitor your server log file.

Steve

=============================================
Steve Miles (smiles@wfubmc.edu)
Wake Forest University School of Medicine
5019 Hanes, Medical Center Blvd.
Winston-Salem, NC 27157
Phone: 336.716.0454     FAX: 336.716.7200
=============================================

Tomer Kalev wrote:

> I need to redirect a user to a password protected page, that is usually
> accessed through a login screen.
> How can I post the login info, as if the user surfed through the login
> screen, and filled in the login form? I don't want the user to see the
> password.
>
> Thanx,
> Tomer.






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

Date: Wed, 24 Feb 1999 16:24:35 -0800
From: KC <hunt@queen.es.hac.com>
Subject: Re: Redirecting to a password protected page
Message-Id: <36D49843.DA30B729@queen.es.hac.com>

Tony Curtis wrote:
> 
> and the relevance to perl is ... ?

Don't be such a wise ass. The guy wants to know how he can do that in
perl...<sigh>
-- 
-----

KC


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

Date: Thu, 25 Feb 1999 00:23:21 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Redirecting to a password protected page
Message-Id: <1dnr94p.3qzfxz3gob7lN@bay1-206.quincy.ziplink.net>

KC <hunt@queen.es.hac.com> wrote:

> Tony Curtis wrote:
> > 
> > and the relevance to perl is ... ?
> 
> Don't be such a wise ass. The guy wants to know how he can do that in
> perl...<sigh>

No, the guy wants to know how he can do that from a CGI script.  There
is no specific relevance to perl.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 25 Feb 1999 07:31:00 -0000
From: "Tomer Kalev" <DblClick@inter.net.il>
Subject: Re: Redirecting to a password protected page
Message-Id: <7b2n99$dr1$1@news.netvision.net.il>

I am familier with the solutions you suggested, the problem with them is
that they expose the password to the end user.
I don't want him to see the login&password I am using.

Tomer


Steve Miles wrote in message <36D32E2C.399092EF@wfubmc.edu>...
>I've been trying to work out something like this for a while. I originally
>had the user login, check to see if the password is OK via Perl, then
>redirect them to the password protected page by using an url in this
>format:
>
>username:password@yoursite.com/protected/here
>
>This actually works with .htaccess if you type it in the browser, BUT, in a
>cgi script it works fine with Netscape but in IE4 it prompts the user for
>the .htaccess password - what we don't want.
>
>THERE IS ANOTHER WAY AROUND THIS, that I though of, but haven't tried yet,
>and that is to redirect the user to a page that has a "meta - refresh" tag
>were they are forwarded to username:password@yoursite.com/protected/here.
>Might work smoothly in both browsers. If you figure out a way to do this,
>let me know!
>
>Would be great because then you can monitor access to your site via the cgi
>script logins rather than have to monitor your server log file.
>
>Steve
>
>=============================================
>Steve Miles (smiles@wfubmc.edu)
>Wake Forest University School of Medicine
>5019 Hanes, Medical Center Blvd.
>Winston-Salem, NC 27157
>Phone: 336.716.0454     FAX: 336.716.7200
>=============================================
>





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

Date: Thu, 25 Feb 1999 13:51:32 +0000
From: Joe <joe_t@joe10.com>
Subject: referer() for security?
Message-Id: <36D5554D.FCF6BB7D@joe10.com>

Hi there,

use(ing) CGI:

I'm trying to keep some CGI scripts secure and free from unwanted use or
input. 

Is it legit to have your main body only execute if referer() returns the page
(or from each of an array) I think the script should be allowed to be called
from? Would this be relatively secure?

TIA, Joe

-- 
Joe Tennis                                      Joe 10 Enterprises
P.O. Box 2133                                 http://www.joe10.com
Mill Valley, CA 94942                                joe@joe10.com
415.905.5878
Custom solutions for interactive media and the World Wide Web
Planning, automation strategies and consulting
      ---------------------------------------------------
    *****  Coming soon... http://www.outdoorsites.com  *****


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

Date: Thu, 25 Feb 1999 19:06:01 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: referer() for security?
Message-Id: <comdog-ya02408000R2502991906010001@news.panix.com>

In article <36D5554D.FCF6BB7D@joe10.com>, joe_t@joe10.com posted:

> Is it legit to have your main body only execute if referer() returns the page
> (or from each of an array) I think the script should be allowed to be called
> from? Would this be relatively secure?

HTTP_REFERER is trivally spoofed.  it is not in any way secure.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: 25 Feb 1999 18:42:10 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: referer() for security?
Message-Id: <36d5fbf2@csnews>

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

In comp.lang.perl.misc, 
    comdog@computerdog.com (brian d foy) writes:
:HTTP_REFERER is trivally spoofed.  it is not in any way secure.

It's also a horribly embarrassing spelling error etched into 
stone by idiots.

    my $ua = LWP::UserAgent->new();

    # give it time, it'll get there
    $ua->agent("Schmozilla/v9.14 Platinum");    

    my $req = HTTP::Request->new(GET => $url);

    # perplex the log analysers
    $req->referer("http://wizard.yellowbrick.oz");  
    # this should be refeRRer, damn it


--tom
-- 
Commenting on the advantages of bisexuality, Woody Allen once remarked,
"It doubles your chances of getting a date on Saturday night."


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

Date: Tue, 23 Feb 1999 10:12:05 +0800
From: Jeremy <scijr@nus.edu.sg>
Subject: Refreshing Popup_Menu
Message-Id: <36D20E5E.6AA03E9@nus.edu.sg>

Hi,

How do I refresh my popup_menu in my perl script using CGI.pm ?
I ran the script populating the popup_menu from a query on a database
and it works fine the first time round.
But the second instance , the values on the popup_menu doesn't seem to
match the query I initiated. Any help is greatly appreciated. Thank you
very much. :-)

Jeremy




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

Date: Mon, 22 Feb 1999 20:52:31 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Refreshing Popup_Menu
Message-Id: <MPG.113bd3e7c16e84de9896b5@206.184.139.132>

Sounds like you have a sticky form issue.  Read about sticky forms in the 
CGI.pm doc.

In article <36D20E5E.6AA03E9@nus.edu.sg>, scijr@nus.edu.sg says...
> Hi,
> 
> How do I refresh my popup_menu in my perl script using CGI.pm ?
> I ran the script populating the popup_menu from a query on a database
> and it works fine the first time round.
> But the second instance , the values on the popup_menu doesn't seem to
> match the query I initiated. Any help is greatly appreciated. Thank you
> very much. :-)

-- 
Bill Moseley mailto:moseley@best.com


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

Date: 22 Feb 1999 21:11:17 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Regular expression for Currency ???
Message-Id: <7ash5l$is0$2@nnrp02.primenet.com>

Tad McClellan <tadmc@metronet.com> wrote:
> bill_mcintyre@my-dejanews.com wrote:
> > For example $123,234.00 (I want to ensure 2 decimal places and a comma
> > every thousand)
>
>    /^\d{1,3}(?:,\d{3})*\.\d\d$/

This seems to be the best of the regular expressions offered, except
for the bug. (The dollar sign is missing.)

     /^\$\d{1,3}(?:,\d\d\d)*\.\d\d$/

To match dollar amounts like "$.02", I suppose you just make
everything between the dollar sign and the decimal point optional.
Right?

     /^\$(?:\d{1,3}(?:,\d\d\d)*)?\.\d\d$/

Look, Ma! No alternation!

-- 
Jim Monty
monty@primenet.com
http://www.primenet.com/~monty/
Tempe, Arizona USA


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

Date: Mon, 22 Feb 1999 11:48:23 -0500
From: "Christopher Pieper" <curweb@cur.org>
Subject: Regular Expressions
Message-Id: <7as1iq$sot$1@news1.Radix.Net>

Here is the code I use to search through a huge email file to filter our all
email addresses in the file.


while(<LINE>) {
 chomp;
 if (m/\s+(\S+@\S+)\s+/) {
  $Address = $1;
  $Address .= "\n";
  print EMAIL $Address;
 }
}

The problem I have is that it is printing all the addresses in a file but it
is including preceeding characters like < " and what not. What would be the
proper regexp to use to filter out all preceding and following characters <
> and ". I know it is something like [^<,>,"] But I couldn't get it to work.
Any help would be greatly appreciated.

Christopher M. Pieper
curweb@cur.org
Council on Undergraduate Research




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

Date: Mon, 22 Feb 1999 23:28:47 +0200
From: "John Chronakis" <vamp71@freemail.gr>
Subject: Re: Regular Expressions
Message-Id: <7ashs5$fop$1@ns1.otenet.gr>

>Here is the code I use to search through a huge email file to filter our
all
>email addresses in the file.
>
>while(<LINE>) {
> chomp;
> if (m/\s+(\S+@\S+)\s+/) {
>  $Address = $1;
>  $Address .= "\n";
>  print EMAIL $Address;
> }
>}
>
>The problem I have is that it is printing all the addresses in a file but
it
>is including preceeding characters like < " and what not. What would be the
>proper regexp to use to filter out all preceding and following characters <
>> and ". I know it is something like [^<,>,"] But I couldn't get it to
work.
>Any help would be greatly appreciated.
>

Why not replacing the pattern with
m/<(.*?@.*?)>/
It will put to $1 the text inside <>

Or just add
s/<//g;
s/>//g;

or use the tr operator.

John





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

Date: 22 Feb 1999 17:50:27 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Regular Expressions
Message-Id: <83btimo018.fsf@vcpc.univie.ac.at>

Re: Regular Expressions, Christopher
<curweb@cur.org> said:

[snip code]

Christopher> The problem I have is that it is
Christopher> printing all the addresses in a file
Christopher> but it is including preceeding
Christopher> characters like < " and what not. What
Christopher> would be the proper regexp to use to
Christopher> filter out all preceding and following
Christopher> characters < and ". I know it is something
Christopher> like [^<,>,"] But I couldn't get it to work.
Christopher> Any help would be greatly appreciated.

You could try solving the problem a different way.

Look at the Mail::Address module (in the MailTools
package on CPAN).  It does the difficult bit for
you.

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Mon, 22 Feb 1999 15:59:57 -0500
From: Gabriel Robichaud <robichag@nt.com>
Subject: remote nt servers
Message-Id: <36D1C54D.E5444AEE@nt.com>

Hey there fellow perlers!

all of the following is on Win NT.  Yay! (*sarcasm*)

I'm trying to write a script that is going to retrieve the content of a
directory on a file server, but the script is run on a different server.

the machine name is zbanb00b and the share name is Arch_pc

this is run on WIN NT server, on an NT network.

#########here is the code#########
#I love perl
###############################
$direct=3D"\\\\zbanb00b\\Arch_pc\\";
opendir(DIR, $direct) || die "cannot open $direct!!!\n";
### end of this fun script


now of course, when I run this I get the following output : =

"cannot open \\zbanb00b\Arch_pc\!!!"

I tried mapping it as X:\ and using "X:\\"  as my value for $direct but
with no more success.  I'm guessing that there is something with server
permission access that i'm missing.  Any info would be much appreciated.

thanks, yer all very kind :)

Gabriel Robichaud
Desktop Specialist \ Sp=E9cialiste en bureautique
Language Services Linguistiques - Nortel Networks

Telephone \ T=E9l=E9phone :	(514) 818-1010 #45870
ESN \ RCE  :         	          884-5870


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

Date: Fri, 26 Feb 1999 13:40:20 -0000
From: "Artoo" <r2-d2@REMOVEbigfoot.com>
Subject: Remove a specific member of an array
Message-Id: <7b68e1$cs$1@plug.news.pipex.net>

Hi All

how can you remove a specific member of an array.

IE:
@array = ('fred','james','alex','andy');
and you want to delete james from the array.

Thanks
Artoo




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

Date: Fri, 26 Feb 1999 06:33:55 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Remove a specific member of an array
Message-Id: <MPG.114050ae74b55a459896be@206.184.139.132>

In article <7b68e1$cs$1@plug.news.pipex.net>, r2-d2@REMOVEbigfoot.com 
says...
> how can you remove a specific member of an array.

perldoc -f splice

And if you don't know the index number, only the value, you can use a 
lookup hash.

-- 
Bill Moseley mailto:moseley@best.com


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

Date: Fri, 26 Feb 1999 07:31:32 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Remove a specific member of an array
Message-Id: <MPG.11405e28f66973ae989694@nntp.hpl.hp.com>

In article <7b68e1$cs$1@plug.news.pipex.net>, on Fri, 26 Feb 1999 
13:40:20 -0000 r2-d2@REMOVEbigfoot.com says...
> how can you remove a specific member of an array.
> 
> IE:
> @array = ('fred','james','alex','andy');
> and you want to delete james from the array.

Assuming you don't know where 'james' is,

  @array = grep $_ ne 'james', @array;

There are many useful Perl functions.  Do `perldoc perlfunc` to get an 
overview, then `perldoc -f grep` for details on this one.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 26 Feb 1999 07:39:37 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Remove a specific member of an array
Message-Id: <MPG.114060149ba11731989695@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <MPG.114050ae74b55a459896be@206.184.139.132>, on Fri, 26 Feb 
1999 06:33:55 -0800 moseley@best.com says...
> In article <7b68e1$cs$1@plug.news.pipex.net>, r2-d2@REMOVEbigfoot.com 
> says...
> > how can you remove a specific member of an array.
> 
> perldoc -f splice
> 
> And if you don't know the index number, only the value, you can use a 
> lookup hash.

Huh???  I showed how to do it using 'grep', but I have no idea what you 
mean.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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