[15448] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2858 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 25 09:05:27 2000

Date: Tue, 25 Apr 2000 06:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <956667908-v9-i2858@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 25 Apr 2000     Volume: 9 Number: 2858

Today's topics:
        CGI script changing NIS+ password bolero92@my-deja.com
    Re: Date standardization without Date::Manip <flavell@mail.cern.ch>
    Re: how to get the error string for ($? >> 8) <gellyfish@gellyfish.com>
        how to put this in one reg exp. <hans-jan@stack.nl>
    Re: how to put this in one reg exp. <tim@pnorthover.freeserve.co.uk>
    Re: how to put this in one reg exp. <hans-jan@stack.nl>
    Re: intrusive record separator at end of line: how can  <gellyfish@gellyfish.com>
    Re: intrusive record separator at end of line: how can  <jd@mukh.asc.ox.ac.uk>
    Re: Java and CGI/Perl Integration. <gti@mobilix.dk>
        JPL install trouble on WinNT <Jens.Fudge.lpt@indbakke.dk>
    Re: JPL install trouble on WinNT <Vincent.Murphy@Baltimore.Com>
    Re: man2html (Bart Lateur)
    Re: man2html <idontlikespam_jcman@worldnet.att.net>
    Re: min/max (Bart Lateur)
    Re: newbie: camel vs. llama <jesucristo2@netscape.net>
    Re: Parsing lines of a file? <mflaherty2@earthlink.net>
    Re: Project structure geoff_gunner@my-deja.com
        removing repetitions in arrays <webmaster@nexus.uk.com>
    Re: removing repetitions in arrays <rhomberg@ife.ee.ethz.ch>
    Re: Running script from hyperlink ? <scotnet@sympac.com.au>
    Re: Running script from hyperlink ? <flavell@mail.cern.ch>
    Re: Running script from hyperlink ? (Bart Lateur)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Apr 2000 07:11:09 GMT
From: bolero92@my-deja.com
Subject: CGI script changing NIS+ password
Message-Id: <8e3gea$ek9$1@nnrp1.deja.com>

Is there any example of cgi script
which is used for changing NIS+ password?

If no, can you tell me how to do it?
Thanks.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 25 Apr 2000 12:24:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Date standardization without Date::Manip
Message-Id: <Pine.GHP.4.21.0004251223430.27322-100000@hpplus01.cern.ch>

On Tue, 25 Apr 2000 drode@my-deja.com blurted out upside-down:

> Your *opinion* on the proper method to quote is noted.

Your entry into the killfile is noted.




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

Date: 25 Apr 2000 07:12:06 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to get the error string for ($? >> 8)
Message-Id: <8e3cvm$4uv$1@orpheus.gellyfish.com>

On Mon, 24 Apr 2000 14:40:26 GMT li wrote:
> 
> Is there a way to get the error string for errors returned by 'system'
> command?
> 
> Graham Barr's Errno.pm gives the system E* status code, but how do one
> gets the string?   (By getting correspondent comment line in the
> errno.h?  :-)
> 

As far as I can determine  these messages are the same as the ones you would
get by assigning the value to $! and printing the result but YMMV :

for ( 1 .. 124 )
{
  $! = $-;
  print "$_ : $!\n";
}

/J\
-- 
No jokes, no taunting--That kid's got bosoms! Somebody get me a wet
towel! C'mere you butterball.
-- 
fortune oscar homer


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

Date: 25 Apr 2000 09:58:00 GMT
From: Hans <hans-jan@stack.nl>
Subject: how to put this in one reg exp.
Message-Id: <8e3q78$acp$1@news.tue.nl>

I'd like to simplify this 

if ($line =~ /<!--begin0-->/) { 
	print POST ("<!--begin0-->\n");
if ($line =~ /<!--begin1-->/) { 
	print POST ("<!--begin1-->\n");
if ($line =~ /<!--begin2-->/) { 
	print POST ("<!--begin2-->\n");
 ........begin10

into

$var1 = 'begin0' OR 'begin1' ....begin 10
if ($line =~ /.....$var1....) {
	print POST ("<!--"+$var+"-->\n");

but so far my attempts have failed. How is it done ?

TIA, Hans


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

Date: Tue, 25 Apr 2000 11:40:17 +0100
From: "Tim Northover" <tim@pnorthover.freeserve.co.uk>
Subject: Re: how to put this in one reg exp.
Message-Id: <vCeN4.2338$Ci6.45921@news6-win.server.ntlworld.com>

Hans <hans-jan@stack.nl> wrote in message news:8e3q78$acp$1@news.tue.nl...
> I'd like to simplify this
>
> if ($line =~ /<!--begin0-->/)

> print POST ("<!--begin0-->\n");
> if ($line =~ /<!--begin1-->/)

> print POST ("<!--begin1-->\n");
> if ($line =~ /<!--begin2-->/)

> print POST ("<!--begin2-->\n");
> ........begin10
>
> into
>
> $var1 = 'begin0' OR 'begin1' ....begin 10
> if ($line =~ /.....$var1....) {
> print POST ("<!--"+$var+"-->\n");
>
It could be done like this:

if($line =~ /(<!--begin\d+-->)/) {
    print POST "$1\n";
}

The \d+ matches 1 or more digits.
The brackets around the expression store its
value in $1 so it can be printed later.

Or if only 1..10 is allowed like this:

if($line =~ /(<!--begin(\d{1,2})-->/ && $1 <= 10) {
    print POST "<!--begin$1-->\n";
}

Here \d{1,2} matches 1-2 digits (in this case 1 or 2)
and they then get compared to 10. (\d+ could have been
used given the check).

Hope this helps.

Tim N.




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

Date: 25 Apr 2000 11:00:38 GMT
From: Hans <hans-jan@stack.nl>
Subject: Re: how to put this in one reg exp.
Message-Id: <8e3tsm$bfo$1@news.tue.nl>

Tim Northover <tim@pnorthover.freeserve.co.uk> wrote:

> It could be done like this:

> if($line =~ /(<!--begin\d+-->)/) {
>     print POST "$1\n";
> }

> The \d+ matches 1 or more digits.
> The brackets around the expression store its
> value in $1 so it can be printed later.

> Or if only 1..10 is allowed like this:

> if($line =~ /(<!--begin(\d{1,2})-->/ && $1 <= 10) {
>     print POST "<!--begin$1-->\n";
> }

> Here \d{1,2} matches 1-2 digits (in this case 1 or 2)
> and they then get compared to 10. (\d+ could have been
> used given the check).

Thanks Tim, but the variables in my program don't look alike (no
begin0..10). I'll use this trick in another program.

My errors were not due to this line but somewhere else. 
if ($line =~ /<!--$INPUT{'veld'}-->/) {
        print POST ("String = <!--$INPUT{'veld'}--> .\n");             
this works fine !

thanks !

Hans


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

Date: 25 Apr 2000 07:42:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: intrusive record separator at end of line: how can I get rid of it?
Message-Id: <8e3eot$518$1@orpheus.gellyfish.com>

On Mon, 24 Apr 2000 18:23:32 +0100 jd wrote:
> I'm writing a small (novice's) script as a way to learn some more
> perl .    I've got a file with errors, and I want to read the file,
> find the errors, correct them, and write the corrected version
> to a tmp file.
> 
> I read the file in, line by line, and chop and split it
> 
>     @Rec = split(/\t/, $_, 9999);
> 
> then I do all the checking and correcting, and write the
> record out:
> 
>     print TMP join("\t", @Rec), "\n";
> 
> This seems to put _both_ the field and the record separator
> at the end of each record:   on altered and on unchanged lines,
> each time I use the script.   So each record (about 5000 of them)
> gets a new tab at the end  each time I  write to file.
> 

My usual mistake is to omit the brackets around the join and thus include
the newline in the joined list.  But you havent done that;-} I can only
imagine that you have an extra, empty field at the end of your record - you
can determine if this is the case by printing $Rec[$#Rec].

/J\
-- 
A subject that is beautiful in itself gives no suggestion to the
artist. It lacks imperfection.
-- 
fortune oscar homer


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

Date: Tue, 25 Apr 2000 10:54:51 +0100
From: jd <jd@mukh.asc.ox.ac.uk>
Subject: Re: intrusive record separator at end of line: how can I get rid of it?
Message-Id: <39056B6B.C14DAE26@mukh.asc.ox.ac.uk>


--------------B1CADB348E0A25F7CDA99EC1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> Many  thanks to Ilmari Karonen and Jonathan Stowe.

I followed IK's advice, and cut the script down to straightthrough-put,
and solved the problem:

I had the record-separator defined twice:  once at the
beginning, in


$,  = "\t";

and again in the print instructions.   Silly mistake, but since
it is recommended in the books, to define output record-separators
at the beginning;  and since all the examples of print statements
include a record-separator,  it is easy enough for a trusting tyro
to make it.     Maybe a 10th edition will say "You don't need to
put an output record-separator in a print statement if you've
defined one in the preamble".

Anyway, thanks to you both ....

jd


--
John Davis

All Souls College
Oxford
+44 (0) 1865 279300
jd@mukh.asc.ox.ac.uk



--------------B1CADB348E0A25F7CDA99EC1
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>

<BLOCKQUOTE TYPE=CITE>Many&nbsp; thanks to Ilmari Karonen and Jonathan
Stowe.</BLOCKQUOTE>
I followed IK's advice, and cut the script down to straightthrough-put,
and solved the problem:

<P>I had the record-separator defined twice:&nbsp; once at the
<BR>beginning, in
<BR>&nbsp;

<P>$,&nbsp; = "\t";

<P>and again in the print instructions.&nbsp;&nbsp; Silly mistake, but
since
<BR>it is recommended in the books, to define output record-separators
<BR>at the beginning;&nbsp; and since all the examples of print statements
<BR>include a record-separator,&nbsp; it is easy enough for a trusting
tyro
<BR>to make it.&nbsp;&nbsp;&nbsp;&nbsp; Maybe a 10th edition will say "You
don't need to
<BR>put an output record-separator in a print statement if you've
<BR>defined one in the preamble".

<P>Anyway, thanks to you both ....

<P>jd
<BR>&nbsp;
<PRE>--&nbsp;
John Davis



All Souls College
Oxford
+44 (0) 1865 279300
jd@mukh.asc.ox.ac.uk</PRE>
&nbsp;</HTML>

--------------B1CADB348E0A25F7CDA99EC1--



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

Date: Tue, 25 Apr 2000 10:58:13 +0100
From: "George Titan" <gti@mobilix.dk>
Subject: Re: Java and CGI/Perl Integration.
Message-Id: <c7dN4.2043$k3.119454@news0.mobilixnet.dk>

I doubt that it will work !
Try connecting to the server instead and use the get command !

try
{
    Socket S=Socket(Server,port);
};
catch(Exception e)
{
   Do Something if error
};

<Get the output and input stream of the socket object>

<write to the output stream the command get URL>

<On the server side the Perl script would be executed and the result would
be sent back to
  applet>
<From the input stream object read the data sent back from Web server>



Joe Edwards <cleanh2o@cleanh2o.com> wrote in message
news:Pine.LNX.4.05.10004182354540.26704-100000@cleanh2o.com...

    public String getPerlCgiOutput(String server, String args) throws
getPerlCgiOutputException {
        InputStream in = null;
        URL url = null;
        byte[] buffer = new byte[2048];
        int bytes_read=0;
        StringBuffer strbuf = new StringBuffer();

        try {
            url = new URL(server+"cgi-bin/perl.cgi?"+args);
            in = url.openStream();
            // read from the URL stream and append them to strbuf
            while((bytes_read = in.read(buffer)) != -1) strbuf.append(new
String(buffer,0));
            return (new String(strbuf);
       } catch(MalformedURLException MUE){ throw new
getPerlCgiOutputException("getPerlCgiOutput MUE="+MUE.toString);
       } catch(IOException IOE){ throw new
getPerlCgiOutputException("IOE="+IOE.toString());
       } catch(Exception E){ throw new
getPerlCgiOutputException("getPerlCgiOutputException E="+E.toString()); }
       finally {  // Always close the streams, no matter what.
           try { in.close(); } catch (IOException IOEX) { ; }
       }
    }


On Tue, 18 Apr 2000, Anthony Bouvier wrote:
> Hello.
> I have a simple question.(I hope it's simple).
>
> Does anybody know a relatively simple way of getting data from a cgi
script
> written
> in perl to a Java applet?
>
> The operation I am performing is relatively simple. I just need to pass
> about 50 lines of ascii text back and forth between a perl cgi script and
a
> Java Applet.
>
>
>
> japh - A Perl5 and Java Interface
> by Alligator Descartes
>
> http://www.symbolstone.org/technology/perl/japh/index.html
>
>
>
> --
> Anthony Bouvier
> Vagabond Programmer
>
>

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
    The keeper of the Wastewater Engineering Virtual Library (WWEVL)
    the WWEVL URL == http://www.cleanh2o.com/
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-





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

Date: Tue, 25 Apr 2000 07:52:36 GMT
From: "Jens Fudge" <Jens.Fudge.lpt@indbakke.dk>
Subject: JPL install trouble on WinNT
Message-Id: <89cN4.3873$oI.155075@news.worldonline.dk>

I've downloaded the JPL, and by following the "Installation under Microsoft
Windows" in the readme, I come to the following problem...

1) I edit the setvars.pl script as described

2) I CD to the JLP dir, I type:
    perl Makefile      result is ok
    nmake                I get the "The name specified is not rcognized as
an internal or external command..." error, I cannot find anything on my disk
with this name
    nmake install      Same as above..

What am I doing wrong???  I have also tried with just "make" but this is
likewise not working

I'd appreciate the help

I'm by the way running WinNT 4.0 with service pack 6 installed.

Jens Fudge




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

Date: Tue, 25 Apr 2000 12:44:00 GMT
From: Vincent Murphy <Vincent.Murphy@Baltimore.Com>
Subject: Re: JPL install trouble on WinNT
Message-Id: <xjgaeiifj03.fsf@gamora.us.cybertrust.com>

>>>>> "JF" == Jens Fudge <Jens.Fudge.lpt@indbakke.dk> writes:

 JF> I've downloaded the JPL, and by following the "Installation under Microsoft
 JF> Windows" in the readme, I come to the following problem...

 JF> 1) I edit the setvars.pl script as described

 JF> 2) I CD to the JLP dir, I type:
 JF>     perl Makefile      result is ok
 JF>     nmake                I get the "The name specified is not rcognized as
 JF> an internal or external command..." error, I cannot find anything on my disk
 JF> with this name

Is nmake in your path?  Is nmake on your machine?  If not that may be
the problem. :-)  

 JF>     nmake install      Same as above..

 JF> What am I doing wrong???  I have also tried with just "make" but this is
 JF> likewise not working

path?

 JF> I'd appreciate the help

 JF> I'm by the way running WinNT 4.0 with service pack 6 installed.

On NT I usually run vcvars32.bat before making perl.  It sets up my path
to use nmake.

-Vinny




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

Date: Tue, 25 Apr 2000 09:28:11 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: man2html
Message-Id: <39066518.8663375@news.skynet.be>

Makarand Kulkarni wrote:

>>  Has anyone else gotten this perl script to work?
>
>yes. I got it to work. It works !!

Gee, that is helpful.

-- 
	Bart.


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

Date: Tue, 25 Apr 2000 12:33:42 GMT
From: "Ira Weiner" <idontlikespam_jcman@worldnet.att.net>
Subject: Re: man2html
Message-Id: <GggN4.22586$PV.1591885@bgtnsc06-news.ops.worldnet.att.net>

The version I have appears to work such that I need to "man <command> |
man2html" and man2html reads stdout and formats it to HTML.  I wrote a
simple script to do this, but it does not recognize my environment variable.
I guess the question now becomes: how to pass an environment variable from a
browswer to a UNIX script

#!/bin/bash
/usr/bin/man  $1 | ./man2html



Bart Lateur <bart.lateur@skynet.be> wrote in message
news:39066518.8663375@news.skynet.be...
> Makarand Kulkarni wrote:
>
> >>  Has anyone else gotten this perl script to work?
> >
> >yes. I got it to work. It works !!
>
> Gee, that is helpful.
>
> --
> Bart.




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

Date: Tue, 25 Apr 2000 07:52:08 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: min/max
Message-Id: <39054762.1057306@news.skynet.be>

Dimitri Ostapenko wrote:

>is there a better (shorter) way to get min/max of 2/many values without
>loading any modules  ?
>
>I use : $min = ($a>$b)?b:a;   for 2 values
>
>and  (sort {$a<=>$b} @nums)[0];   for many
>
>while 2-nd seems concise enough for what it does, I'm too lazy and curious
>about the 1st.

It's concise, but it's also quite inefficient. Say you're comparing 1000
numbers, then you'll roughly do 500000 (N*N/2) comparisons, to get the
minimum or maximum of this list.

A sub looks more efficient to me:

	sub min {
	    my $min = shift;
	    foreach(@_) {
	        $min = $_ if $_ < $min;
	    }
	    return $min;
	}

	$min = min (2, 3, 1);

likewise:

	sub max {
	    my $max = shift;
	    foreach(@_) {
	        $max = $_ if $_ > $max;
	    }
	    return $max;
	}

	$max = max (2, 3, 1);

You want to combine them?

	sub minmax {
	    my $min = my $max = shift;
	    foreach(@_) {
	        $min = $_ if $_ < $min;
	        $max = $_ if $_ > $max;
	    }
	    return ($min, $max);
	}


	($min, $max) = minmax(5, 3, 1, 6, 8, 10, 4);
or
	($min, $max) = minmax(@array);

-- 
	Bart.


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

Date: Tue, 25 Apr 2000 06:56:13 GMT
From: octinomos endemoniado <jesucristo2@netscape.net>
Subject: Re: newbie: camel vs. llama
Message-Id: <8e3fib$di3$1@nnrp1.deja.com>

On Mon, 24 Apr 2000 13:13:37 GMT,
Elaine Ashton <elaine@chaos.wustl.edu> wrote:
#
# in article 8e0v8q$rsp$1@nnrp1.deja.com, octinomos endemoniado at
# jesucristo2@netscape.net quoth:
# > i heard the camel and llama books were pretty good
# > by christiansen...  if so, which one should i start
# > with, what's the difference, why is the camel one
# > more expensive...  any info appreciated...
#
# One spits, one don't.
#
# The one that spits purports to be 'learnin'' Perl for those new to
# Perl not to programming.

what do you mean it spits?

# The one that doesn't spit is a hefty tome
# for those who are already familiar.

what do you mean it doesn't spit?

i'm new to perl, i know some shell scripting
and some awk and some sed... and i wrote
one perl script--at school, like an intro...

i think i'm gonna do what the other guy said
to go check them out at bookstar or barnes & noble,
just to be sure--i'll probably get both eventually
but can only afford one right now...

is amazon really 50% off? i saw them at 20% off
at Fatbrain.com... but if they're really that cheap
at amazon, i might just get both, what the hell....
i find it hard to believe though... hell,
by the time you read this i will have already
gone to amazon to see how much they are...

thanks for the reply...

#
# > jesus christ II
#
# What? The second coming happened and I missed it? damn.

st. peter transcribed your phone number wrong...

#
# e.
#
#

jesus christ II

                      Esoterick : Linkz
                 http://dennes.freeshell.org

_________________________________________________


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 25 Apr 2000 10:58:35 GMT
From: "Mike Flaherty" <mflaherty2@earthlink.net>
Subject: Re: Parsing lines of a file?
Message-Id: <vTeN4.83017$q67.1575829@newsread2.prod.itd.earthlink.net>

Thank you all for your advice.

I was able to "split" the fields and it worked like a champ.  I'll add the
other stuff (like -w) too.

@linedata=split(/ /,$line);

Thanks Again,
Mike




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

Date: Tue, 25 Apr 2000 10:10:51 GMT
From: geoff_gunner@my-deja.com
Subject: Re: Project structure
Message-Id: <8e3qv8$p7q$1@nnrp1.deja.com>

In article <38F74154.25FFBBA7@mWilden.com>,
  Mark Wilden <Mark@mWilden.com> wrote:
> My question is about organising and accessing common routines for a
> project.

I get the same problems, but more so :-(
* multiple projects which share libraries
* projects which reuse an existing library, but need to change it
slightly
All the time having to watch out for module namespace pollution.
I'd dearly like to use @INC as a module filter, but this would a) lead
to implicit, rather than explicit rules, and b) break things like
Apache if two or more projects were running under the same server with
the same module classpath (e.g. CGI::Carp, original and modified).

I've ended up adopting a sort of java-esque approach.
I don't write modules in the standard namespace area, because you never
know what it might break or be broken by.
I have one module meta-class for all my own libraries that are 'stable'
and unlikely to need changing; this is named after the company I work
for (and why not ?).
I then have an additional meta-class for each project, which contains
the libraries specific to that project. If I munge an existing class,
I'll keep the full class path but stuff it under the project meta-
class, so I can clearly see where it derives from.

e.g.

use CGI::Carp;
use myCo::Error_log;
use Proj1::CGI::Carp;

Pro's:
* explicit
* easy to maintain
* consistent
Con's:
* ugly class method invokation

I can live with a little ugliness if it makes my life easier :-)

Geoff


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 25 Apr 2000 12:52:34 +0100
From: "Tony" <webmaster@nexus.uk.com>
Subject: removing repetitions in arrays
Message-Id: <5FfN4.418$y8.109713@news.enterprise.net>

> THIS MESSAGE IS IN MIME FORMAT. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--MS_Mac_OE_3039511954_738231_MIME_Part
Content-type: text/plain; charset="US-ASCII"
Content-transfer-encoding: 7bit

I am making an array (of car models) from a database of cars for sale.

I want to generate an html page with select input fields by grabbing the
names of the
car models and listing them in the select options, but I need to remove all
the duplicate model names from the array.

I have tried to grab each array element in turn, putting it into a new array
then deleting all occurrences of that element from the first array (so it
cannot be found and therefore wont be added again to the second array).   
But it doesn't work.

I need to end up with a single array containing a list of every car model,
listed only once.

Anyone help me with this?





NEXUS NEW MEDIA
"DEDICATED TO INTERNET & MULTIMEDIA DESIGN"
Web: http://www.nexusnewmedia.co.uk
Tel: +44 (0)161 872 6842
Fax: +44 (0)161 877 3374
Email: anthony@nexusnewmedia.co.uk
IMPORTANT NOTICE:
This email is confidential, may be legally privileged,
and is for the intended recipient only. Access, disclosure,
copying, distribution, or reliance on any of it by anyone
else is prohibited and may be a criminal offence. Please
delete if obtained in error and email confirmation to
the sender.
-----------------------------------------------------


--MS_Mac_OE_3039511954_738231_MIME_Part
Content-type: text/html; charset="US-ASCII"
Content-transfer-encoding: quoted-printable

<HTML>
<HEAD>
<TITLE>removing repetitions in arrays</TITLE>
</HEAD>
<BODY BGCOLOR=3D"#FFFFFF">
I am making an array (of car models) from a database of cars for sale.<BR>
<BR>
I want to generate an html page with <B>select</B> input fields by grabbing=
 the names of the<BR>
car models and listing them in the select options, but I need to remove all=
 the duplicate model names from the array.<BR>
<BR>
I have tried to grab each array element in turn, putting it into a new arra=
y then deleting all occurrences of that element from the first array (so it =
cannot be found and therefore wont be added again to the second array). &nbs=
p;&nbsp;&nbsp;But it doesn't work.<BR>
<BR>
I need to end up with a single array containing a list of every car model, =
listed only once.<BR>
<BR>
Anyone help me with this?<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
NEXUS NEW MEDIA<BR>
&quot;DEDICATED TO INTERNET &amp; MULTIMEDIA DESIGN&quot;<BR>
Web: http://www.nexusnewmedia.co.uk<BR>
Tel: +44 (0)161 872 6842<BR>
Fax: +44 (0)161 877 3374<BR>
Email: anthony@nexusnewmedia.co.uk<BR>
IMPORTANT NOTICE:<BR>
This email is confidential, may be legally privileged,<BR>
and is for the intended recipient only. Access, disclosure,<BR>
copying, distribution, or reliance on any of it by anyone<BR>
else is prohibited and may be a criminal offence. Please<BR>
delete if obtained in error and email confirmation to<BR>
the sender.<BR>
-----------------------------------------------------<BR>
<BR>
</BODY>
</HTML>

--MS_Mac_OE_3039511954_738231_MIME_Part--



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

Date: Tue, 25 Apr 2000 14:10:12 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: removing repetitions in arrays
Message-Id: <39058B24.BB6685E@ife.ee.ethz.ch>

Tony wrote:
> 
>  I need to
> remove all the duplicate model names from the array.

> Anyone help me with this?

yes, the faq
perldoc -q unique
- Alex


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

Date: Tue, 25 Apr 2000 19:49:37 +1000
From: Scotty <scotnet@sympac.com.au>
Subject: Re: Running script from hyperlink ?
Message-Id: <39056A31.8DCC424E@sympac.com.au>

Bj=F6rn Comhaire,

as follows:

<a
href=3D"
http://yourdomain.com.au/cgi-bin/dir/script.cgi?any_message_you_need_to_s=
end_with_the_script

">Click
here</a>

you can put a message for you script to act on after the script name by
using the ?.
everything after this (till you get to the quotes of course) will be in
the:
$ENV{'QUERY_STRING'};

You could put that in a vairable :
$command =3D $ENV{'QUERY_STRING'};

then say :
&get_sign_up_page if $command eq 'get_sign_up_page';

or somthing like that.....

Hope this helps.....

Scott Laughton.

"Bj=F6rn Comhaire" wrote:

> Hi,
>
> Does anyone know how to run a cgi script (using POST) from a simple
> hyperlink in stead of some kind of input field ?
>
> Thanks for the help,
> Bj=F6rn
> --
> ________________________________
> Bj=F6rn Comhaire
> FertiPro N.V. - Your partner in IVF and ART
>
> www.fertipro.com



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

Date: Tue, 25 Apr 2000 12:20:47 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Running script from hyperlink ?
Message-Id: <Pine.GHP.4.21.0004251217410.27322-100000@hpplus01.cern.ch>

On Tue, 25 Apr 2000, Björn Comhaire wrote:

> Does anyone know how to run a cgi script (using POST) from a simple
> hyperlink 

By using a proxy to convert the GET into a POST.  This is not a Perl
question.  It's also not a very appropriate thing to do in general, at
least not without due thought, since GET is defined to be apt for
idempotent transactions, while POST is defined to be, at least
potentially, non-idempotent.

As usual, the real question would be "what are you trying to
achieve?". But that would be more appropriately taken up on the CGI
authoring group.

have fun



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

Date: Tue, 25 Apr 2000 07:52:11 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Running script from hyperlink ?
Message-Id: <39064c7a.2361170@news.skynet.be>

Björn Comhaire wrote:

>Does anyone know how to run a cgi script (using POST) from a simple
>hyperlink in stead of some kind of input field ?

Hyperlinks work as a GET.

-- 
	Bart.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 2858
**************************************


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