[8126] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1744 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 27 18:08:18 1998

Date: Tue, 27 Jan 98 15:00:23 -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           Tue, 27 Jan 1998     Volume: 8 Number: 1744

Today's topics:
        check URL <wweng@attila.stevens-tech.edu>
    Re: check URL (Richard Bellavance)
        Conversion to an array <kjt111@hotmail.com>
    Re: Conversion to an array <ajohnson@gpu.srv.ualberta.ca>
    Re: Datachecking a CGI with Javascript. (brian d foy)
    Re: exec, fork and CGI confusion <rsgoheen@pobox.com>
    Re: Freidl's book mystery (Ilya Zakharevich)
    Re: Help with debugging perl outside of web (Chip Salzenberg)
    Re: Help with debugging perl without the web (Richard Bellavance)
    Re: how do I install on BSDI 3.1? <rootbeer@teleport.com>
    Re: IIS 4.0 Perl Problem (Chip Salzenberg)
    Re: Internet Community needs cgi scripts <rootbeer@teleport.com>
    Re: IP Address as new File <rootbeer@teleport.com>
    Re: Perl script reading in HTML POST Form info <sevrins@jup.com>
    Re: perl4, solaris, varargs <rootbeer@teleport.com>
    Re: print<< into variable? (Joshua J. Kugler)
    Re: print<< into variable? <sevrins@jup.com>
        Problem with Socket.sockaddr_in <w.stanton@auckland.ac.nz>
    Re: puzzling result from hex() <franzen@pmel.noaa.gov>
    Re: puzzling result from hex() (Craig Berry)
    Re: Remove elements of array1 from array2. <shaun@ms.com>
    Re: Remove elements of array1 from array2. <rootbeer@teleport.com>
    Re: Survival Of perl <jason@primal.ucdavis.edu>
    Re: Survival Of perl (Earl Hood)
    Re: Win32 Perl & Internet Information Server 4.0 (NT) (Chip Salzenberg)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 27 Jan 1998 21:57:20 GMT
From: Wei Weng <wweng@attila.stevens-tech.edu>
Subject: check URL
Message-Id: <6all80$t2s$1@apocalypse.dmi.stevens-tech.edu>

Hi
Is there anyway to use perl to test a URL is valid or not? 
say URL like http://www.ibm.net/products.html. 
any help will be grealty appreciated. 

-- 
Wei Weng wweng@stevens-tech.edu
http://attila.stevens-tech.edu/~wweng
--------------------------------------------------------------------------
Darkness beyond twilight, crimson beyond blood that flows ... buried in
the flow of time ... in the great name, I pledge myself to darkness, all
the fools who stand in our way shall be destroyed ... by the power you and
I possess, DRAGON SLAVE! 
--------------------------------------------------------------------------
main(a,b){a="main(a,b){a=%c%s%c;b='%c';printf(a,b,a,b,b);}";b='"';printf
(a,b,a,b,b);}main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}";printf(a,34,a,
34);}main(a){printf(a="main(a){printf(a=%c%s%c,34,a,34);}",34,a,34);}
---------------------------------------------------------------------------


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

Date: 27 Jan 1998 17:18:03 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: check URL
Message-Id: <6almer$po8@ocean.CAM.ORG>

In article <6all80$t2s$1@apocalypse.dmi.stevens-tech.edu>,
Wei Weng  <wweng@attila.stevens-tech.edu> wrote:
>Hi
>Is there anyway to use perl to test a URL is valid or not? 
>say URL like http://www.ibm.net/products.html. 
>any help will be grealty appreciated. 
>

You should have a look at the LWP module.  You can find it on the CPAN, at
"http://www.perl.com/CPAN".  It allows a Perl program to access Web sites as
if it was a browser.

Good luck !
Richard.

-- 
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
    "All along this path I tread  /  My heart betrays my weary head
     With nothing but my love to save / From the cradle to the grave"
                                 (Eric Clapton, "From the cradle")


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

Date: 27 Jan 1998 15:59:17 +600
From: "Kevin Tonkin" <kjt111@hotmail.com>
Subject: Conversion to an array
Message-Id: <01bd2b6f$2dd8f780$7a96c4ce@hsegal.dnvr.uswest.net>

Can someone tell me if it is possible to convert the variables from a
database file to an array?

Example:  Database stored in a text file like so...

Bob|24|blue|single
Fred|32|green|married

If I wanted to put blue and green into an array, how would I achieve this?

Any help would be appreciated!
Kevin


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

Date: Tue, 27 Jan 1998 16:32:07 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Conversion to an array
Message-Id: <34CE6067.45263E5F@gpu.srv.ualberta.ca>

Kevin Tonkin wrote:
!
! Can someone tell me if it is possible to convert the variables
! from a database file to an array?
! 
! Example: Database stored in a text file like so...
! 
! Bob|24|blue|single 
! Fred|32|green|married
! 
! If I wanted to put blue and green into an array, how would I
! achieve this?
! 
! Any help would be appreciated! Kevin

check out the split() function, and the perlre manpage
perldoc -f split
perldoc perlre

#!/usr/bin/perl -w
while(<DATA>) {
    push @colours,(split /\|/)[2];
}
print "@colours\n";
__DATA__
Bob|24|blue|single 
Fred|32|green|married

hope it helps
regards
andrew


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

Date: Tue, 27 Jan 1998 18:00:22 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Datachecking a CGI with Javascript.
Message-Id: <comdog-ya02408000R2701981800220001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6alk7g$r5p$1@charm.magnus.acs.ohio-state.edu>, "SPLiNTeR" <mr.t@umich.edu> posted:

>thanks for the help.

what did you expect?  if you want javascript answers, go over to
comp.lang.javascript.

-- 
brian d foy                                  <comdog@computerdog.com>
not the worst article, but certainly a good nomination


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

Date: Tue, 27 Jan 1998 14:24:19 -0800
From: rsgoheen <rsgoheen@pobox.com>
To: Dan Caugherty <dcaugh@poodle.nortel.ca>
Subject: Re: exec, fork and CGI confusion
Message-Id: <34CE5E93.3136A158@pobox.com>

Dan Caugherty wrote:
> 
> Robert Goheen wrote:
> >
> (snip)
> >                                         I came up with the following
> > statement at the end of my script, which executes after a page has been
> > sent to the user:
> >
> >   unless ($pid = fork) {
> >      unless (fork) {
> >        close (STDOUT);     # end of output to browser.
> >        exec "cleanup.pl";
> >        exit 0;
> >        }
> >      exit 0;
> >   }
> >   waitpid($pid,0);
> >
> > And it works fine.  The script cleanup.pl runs fine.  HOWEVER, the page
> > gets sent to the user 3 times.
> 
> What about trying this modification:
> 
> #       ..print the page...ok,now we're done..
>    close(STDOUT);  # children can't flush unempty buffers now
> 
>    unless ($pid = fork) {
>       unless (fork) {
>         exec "cleanup.pl";
>         # don't bother flushing STDOUT in cleanup.pl now
>         exit 0;
>         }
>       exit 0;
>    }
>    waitpid($pid,0);

I've tried that (at least, I think I have ... I'm beginning to see
double from working on this too much), but it seems to keep cleanup.pl
from executing or executing properly.  So, I'm not entirely certain
where the problem lies.  I don't know if closing STDOUT before the
fork calls interferes with cleanup.pl (which writes to a file and to a
database using NDBM_File), or if there is something wrong with the the
way I'm calling the exec, or something else.  Debugging CGI,
especially anything complex, is such a pain . . . . 


 
> Child processes inherit file descriptor status, so "nailing the
> door shut" on STDOUT may help.
> 
> HTH,
> --  Dan not a perl god, just a fan C.
> 
> +---------------------dcaugh@poodle.nortel.ca------------------------+
> | Dan Caugherty                  | All opinions herein are MINE only.|
> | Member of Sci. Staff, Irritant,| Remove dog from address to reply. |
> | and Collector of Spare Change  |                                   |
> +---------------------dcaugh@poodle.nortel.ca------------------------+


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

Date: 27 Jan 1998 22:46:36 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Freidl's book mystery
Message-Id: <6alo4c$oes$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Chip Salzenberg
<chip@pobox.com>],
who wrote in article <6ale8n$1h0$1@cyprus.atlantic.net>:
> According to ilya@math.ohio-state.edu (Ilya Zakharevich):
> ><joseph@5sigma.com>:
> >> The last time I benchmarked string nibbling it was slow on larger
> >> strings.  Perhaps it was moving a large pointer.
> >
> >Correct.  Around 5.003_07 a patch made it into RE processor which made
> >scalar m//g to copy the string *on each iteration*.
> 
> I've just researched this.  Ilya is mistaken, or else has left out
> important information.

You are right, in 2% of cases scalar m//g will be quick.  Sorry for
omitting this info (but it was 98% of cases that I was concerned
about).  (And if you are interested where these digits came from, be
not: just from my head - but my head is coupled with my experience).

> The patch in question copies the matched string on each iteration of
> scalar m//g *ONLY* if it will be needed because (1) there are parens
> in the pattern, so the values of $1 etc must be preserved
> indefinitely, or (2) the $& variable has been used in the program, so
> its value must be preserved indefinitely.

> Therefore, whatever slowdown accured due to this patch -- and I do
> not believe it to be as significant as Ilya states

It was not my statement, I was just repeating what I've heard - and
the same guy provided a short test case which showed 100x slowdown -
which I easily reproduced.  

I know that some my modules (liek Text::TeX) are unexpectedly slow,
and I believe they are slow due to //g - though I have no way to run
them with an older engine.

> -- it is necessary > to maintain Perl's correct operation.

Probably.  *And* maintain the situation when people cannot upgrade --
since their programs are not usable with the newer Perls.

Ilya


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

Date: Tue, 27 Jan 1998 21:56:04 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Help with debugging perl outside of web
Message-Id: <6all93$2sc$1@cyprus.atlantic.net>

According to David Morris <dbm@cadence.com>:
>Hello folks ... I'm interested in a technical solution for the following:
>I have a collection of perl programs that usually are executed through the
>web, and therefore, have the environment variable REQUEST_METHOD set by the
>browser calls (usually set with method=POST statements).
>
>What I would like to do now is try debugging these as stand-alone, without the
>web environment.

You could start your program off with assignments to the various
%ENV variables you care about:

   unless ($ENV{FOO}) {
      $ENV{FOO} = "foo";
      $ENV{BAR} = "bar";
      # ...
   }

-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

Date: 27 Jan 1998 17:09:23 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: Help with debugging perl without the web
Message-Id: <6alluj$pfp@ocean.CAM.ORG>

In article <34CE4EC1.5C831C6F@cadence.com>,
David Morris  <dbm@cadence.com> wrote:
>What I would like to do now is try debugging these as stand-alone, without the
>web environment. When attempted I get the expected:
>
>C:\PublicFolder\public_html\cgi-bin>perl -d buildrpt.pl
>Content-type: text/html
>Content-type: text/html
>cgi-lib.pl: Unknown request method:
>
>What would any of you suggest I do to short circuit the errors coming out of
>the check for request method type? I can think of maybe forcing the assignment
>of REQUEST_METHOD, but I'm unclear on the grammar. Of course, there may be
>alternative solutions as well.
>

Simple: use CGI.pm instead of cgi-lib.pl !  It can take the arguments from
STDIN, the command-line, or (of course) the CGI methods.  And it even has
a "cgi-lib.pl-compatible" mode if you don't want to redo all your scripts.

Richard.
-- 
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
    "All along this path I tread  /  My heart betrays my weary head
     With nothing but my love to save / From the cradle to the grave"
                                 (Eric Clapton, "From the cradle")


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

Date: Tue, 27 Jan 1998 14:48:19 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: SysAdmin <root@wingnet.net>
Subject: Re: how do I install on BSDI 3.1?
Message-Id: <Pine.GSO.3.96.980127144610.22373r-100000@user2.teleport.com>

On Tue, 27 Jan 1998, SysAdmin wrote:

> Does anyone have any pointers for installing on a BSDI 3.1 system?

If anyone has any pointers which aren't already included in the
hints file and other docs which come with Perl, please add them. Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 27 Jan 1998 21:51:51 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: IIS 4.0 Perl Problem
Message-Id: <6all16$2rh$1@cyprus.atlantic.net>

According to Jon Jenkins <jenki021@tc.umn.edu>:
>I had NT Perl Build 513 running on IIS 3.0 (scripts worked both from the
>command prompt and a web browser.  However, after I upgraded to IIS 4.0
>scripts will no longer run from the browser ...

Sounds like you need a group about IIS.  IIS upgrades are not a Perl
issue.  Sorry.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

Date: Tue, 27 Jan 1998 14:34:30 -0800
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Internet Community needs cgi scripts
Message-Id: <Pine.GSO.3.96.980127142254.22373p-100000@user2.teleport.com>

On 27 Jan 1998, John Paulson wrote:

> Office Biz-On-line Business Community needs a Perl-CGI script to
> automate our Web page creation.  We will exchange Free Web space, 1 POP
> E-mail account and recognition for the program and programming. 

I need someone to paint my house. If you do this, I'll show you ways to
get free web space and free email.

    http://www.yahoo.com/Business_and_Economy/Companies/
	Internet_Services/Web_Services/Free_Web_Pages/
    http://www.yahoo.com/Business_and_Economy/Companies/
	Internet_Services/Email_Providers/Free_Email/

Not only that, but you'll get recognition: I'll tell everybody that I got
you to do this for me. At every opportunity. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 27 Jan 1998 14:21:22 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tad McClellan <tadmc@flash.net>
Subject: Re: IP Address as new File
Message-Id: <Pine.GSO.3.96.980127142035.22373o-100000@user2.teleport.com>

On Tue, 27 Jan 1998, Tad McClellan wrote:

> Date: Tue, 27 Jan 1998 09:47:24 -0600
> From: Tad McClellan <tadmc@flash.net>
> Newsgroups: comp.lang.perl.misc
> Subject: Re: IP Address as new File
> 
> Derek Blandford (blan0416@uidaho.edu) wrote:

> : And you do not use parenthesis when printing to the file....
> 
> : Jason Hansen wrote:
> 
> : > print TEMP_FILE ("$remote_address|$url\n");

> Well, you _can_ use parenthesis when printing if you want to.
> 
> Of course, you need to do it correctly  ;-)

>    print(TEMP_FILE "$remote_address|$url\n");

Not that that is any more correct than what Jason Hansen had written, of
course. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Tue, 27 Jan 1998 17:14:04 -0500
From: Richard Sevrinsky <sevrins@jup.com>
To: mgeorgeadis@fallschurch.esys.com
Subject: Re: Perl script reading in HTML POST Form info
Message-Id: <34CE5C2C.9926682C@jup.com>

mgeorgeadis@fallschurch.esys.com wrote:

> Let me get right to the point. I'm constructing web pages using perl
> scripts, which parse the info submitted from the previous form. However,
> a security problem has arisen which added an additional password field
> to the login page. Submission of the form info causes the fields and
> values to appear in the URL. I know that the METHOD=POST option of
> FORM in HTML solves this problem, but I'm not sure how to access the
> info passed to the next perl script.( The GET Method passes the info
> into the QUERY_STRING variable. The scripts now access and parse
> out the info from QUERY_STRING.) Any ideas? Thanks.

Very simple. Switch to CGI.pm
(http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html or
available from CPAN).

- Richard



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

Date: Tue, 27 Jan 1998 14:18:44 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tony Finch <fanf@demon.net>
Subject: Re: perl4, solaris, varargs
Message-Id: <Pine.GSO.3.96.980127141317.22373n-100000@user2.teleport.com>

On 27 Jan 1998, Tony Finch wrote:

> Our customers want to be able to use perl 4 for their CGI scripts,

No, they don't. They want to use Perl 5. They simply don't know that yet. 
It is therefore your job to educate them. :-) 

Modern versions of Perl have literally _thousands_ of improvements over
Perl 4, including key security-related bug fixes. If your customers care
about their data, they want the version with the fixes.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 27 Jan 1998 22:08:09 GMT
From: jkugler@inreach.com (Joshua J. Kugler)
Subject: Re: print<< into variable?
Message-Id: <34ce5a6d.7624413@news.inreach.com>

On Tue, 27 Jan 1998 20:51:35 +0100, tony@svanstrom.com (Tony L.
Svanstrom) wrote:

[Posted and E-mailed]

()I have a question about this to:
()
()What if I want to "print" to a variable a couple of times and I
don't
()want to replace the information already in it?
()
()Right now I'm trying to rewrite a script that uses print to send
some
()information to sendmail, I'd rather save it somewhere and then send
it
()all to sendmail at the same time instead of a line at a time like it
is
()now.

$text = join("", $text, $newtext);

That will append.  Swap $text and $newtext to prepend.

j----- k-----




I read this group. Sometimes my ISP doesn't. Please e-mail too.

Joshua J. Kugler
Computer Consultant--Web Developer
jkugler@inreach.com
http://www.cwebpages.com/jkugler
Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!



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

Date: Tue, 27 Jan 1998 17:07:50 -0500
From: Richard Sevrinsky <sevrins@jup.com>
To: "Tony L. Svanstrom" <tony@svanstrom.com>
Subject: Re: print<< into variable?
Message-Id: <34CE5AB5.E9EF47BF@jup.com>

Tony L. Svanstrom wrote:

> What if I want to "print" to a variable a couple of times and I don't
> want to replace the information already in it?
>
> Right now I'm trying to rewrite a script that uses print to send some
> information to sendmail, I'd rather save it somewhere and then send it
> all to sendmail at the same time instead of a line at a time like it is
> now.

$msg = <<EOT;...First part of message.....
EOT

$msg .= <<EOT;
 ....Second part of message....
EOT

open(MAIL,'| /usr/bin/sendmail $recipient');
print MAIL $msg;
close MAIL;

- Richard




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

Date: 28 Jan 1998 11:28:16 +1200
From: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: Problem with Socket.sockaddr_in
Message-Id: <wksoq9ijjj.fsf@auckland.ac.nz>

Friends

 In sockaddr_in in the Socket package there is the condition...
if (@_ == 6 && !wantarray) { # perl5.001m compat; use this && die
						^^^^^^^^^^^^^^^  
					(BTW...	What does this mean?)
To use this sub this condition must evaluate to true...

So, when I call it like...

use IO::Socket;
[snip]
my $sock = IO::Socket->new;
[snip]
    my ($s, $paddr) = $sock->accept(); 
    my $pn = $s->peername;
    my($pt, $iaddr) = $s->sockaddr_in($pn);

I get a usage error.

I only need to make this call to print a pretty message to the user,
but I am worried that this is symptomatic of other, deeper problems. 



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

Date: Tue, 27 Jan 1998 14:14:49 -0800
From: Nathan Franzen <franzen@pmel.noaa.gov>
Subject: Re: puzzling result from hex()
Message-Id: <Pine.SOL.3.96.980127135131.7827A-100000@corona.pmel.noaa.gov>


Earlier, I asked some questions, including
> >And shouldn't the result of the mod operator (%) *always* be positive?
> 
& On Tue, 27 Jan 1998, Chip Salzenberg wrote:
> No.  However, you may wish to upgrade to Perl 5.004_04.  We spent
> a lot of time on modulo, getting it exactly right.

I wonder if you could elaborate on this.  It does not accord with my
(perhaps simplistic) idea of the operator.

-------

Actually, I'm interested in elaboration on a couple other topics as well.
In puttering around with the hex() function, I discovered that it behaved
in a consistent (...but to my knowledge (and I *did* look (say it now
in a lowercase whisper (shhh...(undocumented) ) ) ) fashion.  To wit:

print hex('alfred'); ---> 10
print hex('dmitri'); ---> 13
print hex('gary'); ---> 0

It's just not what I expected.

-------

As I mentioned in my first message, what I wanted to do was to be able to
pass a number (an integer, even) into hexadecimal form and then back into
decimal form and have it remain the same.

It happens that this:
 
   $newX = hex( sprintf("%lx", $oldX));

does not work for negative numbers.  This problem isn't going to kill my
program (in fact I've already found another *way to do it*), but I would
like to know how to deal with signed hex numbers.  Any hints?

-------

About the 5.004 thing, yeah, I kinda figured that was the problem.  Anyone
care to talk about this particular bug in 5.003?  Or is 5.003 dead and we
try not to speak ill of it?

-------

-Nathan



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

Date: 27 Jan 1998 22:46:16 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: puzzling result from hex()
Message-Id: <6alo3o$47k$1@marina.cinenet.net>

Nathan Franzen (franzen@pmel.noaa.gov) wrote:
: Actually, I'm interested in elaboration on a couple other topics as well.
: In puttering around with the hex() function, I discovered that it behaved
: in a consistent (...but to my knowledge (and I *did* look (say it now
: in a lowercase whisper (shhh...(undocumented) ) ) ) fashion.  To wit:
: 
: print hex('alfred'); ---> 10
             ^ hex a = 10, l is not a hex char.

: print hex('dmitri'); ---> 13
             ^ hex d = 13, m is not a hex char.

: print hex('gary'); ---> 0
             ^ g is not a valid hex char.

hex() appears to operate by taking the maximal initial string of
valid hex chars and operating on that, ignoring anything afterward.
I can't find anything about this in a brief check of the doc, but
I'd guess it's in there somewhere.  Also, this behavior is consistent
with how int() works.

: It's just not what I expected.

Some of you may recall a brief but fondly-remembered era during which
numerous webpages sported bilious green backgrounds with unreadably pale 
text on top -- at least as seen in certain browsers.  This was just after
color names became widely used as alternatives to six-char hex color 
values (#RRGGBB).  A certain widely-used browser version did not know 
about named colors, but rather just ate whatever color string it saw as
if it were in '%2.2x'x3 format.  The ever-popular background color 
"black", when viewed through this format, yields R=0x0b, G=0xac, B=0x00.
Such fun.  Almost as fun was that "white" became (nearly) black, and 
"green" became...bright green (00EE00). :-)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Tue, 27 Jan 1998 17:29:04 -0500
From: Shaun Ledford <shaun@ms.com>
To: Greg Bacon <gbacon@cs.uah.edu>, Honza Pazdziora <adelton@fi.muni.cz>
Subject: Re: Remove elements of array1 from array2.
Message-Id: <34CE5FB0.4DEA44D3@ms.com>

Greg Bacon wrote:
> 
> [Posted and mailed]
> 
> In article <34CE0A49.5FBA09E2@ms.com>,
>         Shaun Ledford <shaun@ms.com> writes:
> : Is there a clean way of removing the elements of hash table 1 ( login
> : name ) from hash table 2 ( names and password file )?
> 
>     delete @hash2{ keys %hash1 };
> 
> Hope this helps,
> Greg
> --

I think your close but it did'nt work. I'm working with data that looks
like this:
----------------------------------------------------------------------------------
I'm trying to remove each val of %1 from %2.

Thanks Again
Shaun.

	%1		%2
    key    val      key    val
    ----------      ----------
     1     foo	     1     foo Password = "bar"
     2     abc       2     xyx Password = "..."
                     3     abc Password = "foo"
                     4     xyz Password = "jsh"


	%RESULT
     key       val
     -------------
      1	       xyx Password = "..."
      2        xyz Password = "jsh"


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

Date: Tue, 27 Jan 1998 14:43:52 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Douglas Wilson <dgwilson@gte.net>
Subject: Re: Remove elements of array1 from array2.
Message-Id: <Pine.GSO.3.96.980127143650.22373q-100000@user2.teleport.com>

On Tue, 27 Jan 1998, Douglas Wilson wrote:

> Shaun Ledford wrote:
> > 
> > Is there a clean way of removing the elements of hash table 1 ( login
> > name ) from hash table 2 ( names and password file )?

> #!/usr/local/bin/perl -w
> #Remove h2 keys from h1
> %h1=qw(a 1 b 2 c 3);
> %h2=qw(a a b b);
> $str=join("|",keys(%h2));
> %h1=map {$_=>$h1{$_}} grep(!/^($str)$/,keys(%h1));
> for (keys(%h1)) {
>  print "$_=$h1{$_}\n";
> }

I don't like that regular expression; it presumes too much about the keys
in one hash. (Also, I think your %h1 is Shaun's "hash table 2", and vice
versa.) 

As I read it, Shaun wants to delete any element in hash2 which has a
corresponding key in hash1. With a recent version of Perl, this should do
that.

    delete @hash2{ keys %hash1 };

(If there are more than, say, 100 keys in %hash1, I'd probably do this in
a loop, though.) Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/





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

Date: Tue, 27 Jan 1998 13:55:48 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: Survival Of perl
Message-Id: <Pine.OSF.3.95.980127131405.8876J-100000@primal.ucdavis.edu>

On Tue, 27 Jan 1998, Chip Salzenberg wrote:

> According to FHeasley@chemistry.com (Frank):
> >Depending on how you look at it, the web is either a problem, or an
> >opportunity for perl.  I see it as an opportunity, for the time being.
> >Later on, it could become a problem.  However, no amount of verbiage
> >is going to make it go away.
> >
> 
> And this disagrees with others' comments ... how?
> 
> The web is not Perl's cutting edge, but it *is* its primary draw
> to the non-Perl-aware public.  For now.
> 
> Does this fact imply some action on our part?

<sticks head out from wing-flat to check if tomatoes are still flying>

It depends (typical economist answer).

I learned (some) Perl to help me to transform ugly output from an
econometric program into input for a pretty LaTeX table...and stayed to
(re)learn programming.  I now use Perl to do a remarkable variety of
things.  If I were a Real Programmer, I suppose I might (re)learn
FORTRAN for some of the numeric computations, but I'm not.  I'm kind of
a low-grade hacker who needs some machine help with a lot of different
things, and have found that Perl works for me to get many of them done.

In a way it is a throwback to the old days, before shrink-wrap, when
people knew how to cause the computer to do good things.  Programming was
not something done in programming shops, it was done *by the end user.*

I do not deny that there is a role for the stand-alone programmer,
nor even for the shrink-wrap factory.  But at least for me, and I
suspect for other people, a decent all-purpose programming language can
be very helpful, and fills needs that we didn't know existed.  /C+*/ is
not it...too hard for us amateurs.  I really don't *know* that Perl is
the right language for that...but it sure works well for me.

So what has this to do with scores (hundreds?) of off-topic posts by
people who *should* be using CGI.pm, reading the faq, and posting to
*.cgi-authoring ?  Just this.  Those  Clueless Newbies *are* all using
Perl (or at least a very small subset of it), in much the same way that
I started out using a subset of Perl (string processing stuff).  Many of
them may well stumble into the discovery that small-scale programming is
Fun and Useful.  Hey, some of them may even be convinced that for a wide
variety of purposes the mass-produced schlock is not as good as a custom
solution, written by a Perl Pro, but which they can (to some extent)
maintain.

I  (and I suspect the previous target of the Perl Pros' Tomatoes) do not
prescribe any new programming effort, nor argue with the Tomato Hurlers
opinions about what is or isn't hip or hard or important.  I also
respect  (tremendously) all the free help that you people hand out
(which I have mostly got by reading, and reading, and reading), and
understand your frustration with repeated clueless questions.  

And yet... the level of snappishness in this newsgroup has increased so
much since I first perused it, that I fear that I might have written Perl
off as a difficult (well, I think the OO stuff is hard) language used
mainly by a lot of arrogant and rude people.  That would be too bad, at
least for me.  

So I answer, "it depends."  If you want some of the Clueless Newbies to
stick around, quietly perhaps, and come back, and become decent and
confident users of their computers and this wonderful language, then
there is something you (plural!) can do:  edit the venom from the
flames, offer politely (as many of you do) the suggestion to go to a
more appropriate newsgroup, perhaps even ship off the canned discussion
of where the boundary lies between a CGI question and a perl question.
If instead you wish there to be a Sacred Priesthood of Perl, to which
None but the Brilliant May Aspire, then by all means set the
flamethrowers on Scorch.

Of course, even that might not work: Perl is such a cool language that
it may salve even the third-degree net.burn ...



btw, I think the thread is badly misnamed...the question is not at all
the *survival* of Perl but rather Perl outreach.

---------------------------------------------------------------------------
Jason Christian                          University of California, Davis 
jason@primal.ucdavis.edu                  Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614   Davis, CA 95616



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

Date: 27 Jan 1998 21:55:35 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Survival Of perl
Message-Id: <6all4n$74s@news.service.uci.edu>

In article <EnGA4H.5zu@world.std.com>,
Andrew M. Langmead <aml@world.std.com> wrote:

>If you have (or are looking for) the type of job that someone
>specifies the type of tools you do for the job, then you are probably
>best off learning the tools you will be asked to use.
>
>If you have (or are looking for) the type of job that someone asks you
>to create a solution to some problem, then you are best off
>researching different types of tools and determining which are
>appropriate for which task.

Unfortunately, man employers/recruiters do not think this way.  The
former is more common, even if the latter is what is really needed.
The majority of the people that hunt for employees are not technical.
They are told to look for someone who knows tool X, Y, and Z, instead
of the underlying concepts behind X, Y, and Z.  As an example, I worked
for a place where we were doing Sybase development work and needed a
person to help.  So instead of management/HR looking for anyone with
RDBMS experience, they looked at resumes that said Sybase.

The sad case is that many tool choices are determined by political or
ignorant means by untechnical people (aka management) (eg: people
blinding moving to WinNT from Unix).  So the chance at having the
luxury to choose the right tool for the right job can be rare.

My previous employer would not have seriously considered Perl for
project work if I did not campaign for it and used it in the jobs I was
responsible for.  If Perl was a M$ product (heaven forbid), no sales
work would have been required.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Tue, 27 Jan 1998 22:06:50 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Win32 Perl & Internet Information Server 4.0 (NT)
Message-Id: <6allte$2vm$1@cyprus.atlantic.net>

According to cristi@obs-us.com:
>IIS is not set up by default to handle perl scripts

Sounds like you need an IIS group.
Try comp.infosystems.www.servers.misc.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

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

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