[13060] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 470 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 11 21:07:26 1999

Date: Wed, 11 Aug 1999 18:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 11 Aug 1999     Volume: 9 Number: 470

Today's topics:
        'use strict' - what will I lose if I forgo the pragma? <pvoris@earthlink.net>
    Re: ActivePerl PerlScript -- funny problems <john@dlugosz.com>
    Re: ActivePerl PerlScript -- funny problems <john@dlugosz.com>
    Re: ActivePerl PerlScript -- funny problems (Matt)
        alphabetical listing <noelflan@indigo.ie>
    Re: Another quick question...Arrays...testing against (Donovan Rebbechi)
    Re: Another quick question...Arrays...testing against <USENET@questionexchange.com>
        Automatically update web page daily weicai@my-deja.com
    Re: CGI Error - CGI application misbehaved (Larry Rosler)
    Re: Comma seperated numbers (brian d foy)
    Re: Database conversion <USENET@questionexchange.com>
    Re: Dereferencing anon hash (Donovan Rebbechi)
        embedded SQL <jsimpson@haywire.csuhayward.edu>
    Re: Help with -X (Martien Verbruggen)
    Re: Help with -X <USENET@questionexchange.com>
    Re: is our reese the author of mysql book? (Abigail)
        New Book on Perl Tool Development <etoupin@toupin.com>
    Re: New Book on Perl Tool Development <JFedor@datacom-css.com>
    Re: NO-ONE USES PERLQT !!!!!!!!!!!!!!!!!!!!!??????????? (Larry Rosler)
    Re: NO-ONE USES PERLQT !!!!!!!!!!!!!!!!!!!!!??????????? (Larry Rosler)
    Re: obtaining local IP address in ActivePerl <cassell@mail.cor.epa.gov>
    Re: obtaining local IP address in ActivePerl <cassell@mail.cor.epa.gov>
        perl -splice - add an element/delete jatgirl@yahoo.com
    Re: Perl is eating up my memory <USENET@questionexchange.com>
    Re: printf vs. sprintf: inconsistent? <tchrist@mox.perl.com>
    Re: Problem reading forms with perl <cassell@mail.cor.epa.gov>
    Re: Problem using last with a label <USENET@questionexchange.com>
    Re: Stripping quotes only from HTML tags (elephant)
    Re: UpperCase first letter of string only. (brian d foy)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 12 Aug 1999 00:04:03 +0000
From: Phil Voris <pvoris@earthlink.net>
Subject: 'use strict' - what will I lose if I forgo the pragma?
Message-Id: <Pine.LNX.4.10.9908112318250.1774-100000@localhost.localdomain>

I 'use strict;' because I think it makes for better programs.  However, I
am currently working on a program for which I have the option to use a .rc
config file containing executable Perl code (actually a large
configuration hash).  In order to add this functionality, I would have to
forgo the strict pragma because I cannot my the configuration hash.  

What sort of performance hit should I expect if all code -- excepting this
one configuration hash -- complies to strict, but the strict pragma is not
used?

Thanks,
Phil





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

Date: Wed, 11 Aug 1999 19:28:02 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: Re: ActivePerl PerlScript -- funny problems
Message-Id: <4130B26269D8FBE6.D93D06337C1364CA.5C3EC0044175ED8B@lp.airnews.net>


Matt <mck@iag.net> wrote in message news:37b0528e.8353631@news.iag.net...
> On Tue, 10 Aug 1999 10:07:09 +0100, "Nick Liebmann" <Nick@ucecom.com>
> wrote:
> Assuming IIS4 which a safe bet
> because ActiveState is a Win32 port, the following links will give
> some examples:

Actually, that's part of the problem -- all the "culture" and advice on-line
concern ASP.  Very little is said about client-side scripting.

In my case, I'm using IE as a GUI for Perl.  The script alters the content
of the page on the fly to interact with the user, as well as saving the end
result (a report) to a new HTML file.

--John




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

Date: Wed, 11 Aug 1999 19:25:24 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: Re: ActivePerl PerlScript -- funny problems
Message-Id: <FA050A790A60679B.29D6642BCA0F7E55.9E6731A44B08C620@lp.airnews.net>


Nick Liebmann <Nick@ucecom.com> wrote in message
news:7oor1q$b29$1@nclient9-gui.server.ntli.net...
> You cannot embed perl script into HTML code. It's the other way round, the
 ...
> You can't use Language= "Perlscript"...
>
> Try rearranging the code so that all of the perl and html are separate and
> then you can call up the subs in turn eg.


That has got to be the most stupid thing I've seen posted here today.  I
didn't say "this mess of source text doesn't get swolloed by any tool I
have... please help out a newbe."  I reported a =specific= problem and gave
working code as well as non-working code.

Clearly I can (and do) embed perl into HTML code.  As long as I don't assign
to $main::document, that is.

You might want to check out ActiveState's page on PerlScript.

--John





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

Date: Thu, 12 Aug 1999 00:52:22 GMT
From: mck@iag.net (Matt)
Subject: Re: ActivePerl PerlScript -- funny problems
Message-Id: <37b31868.22778013@news.iag.net>

On Wed, 11 Aug 1999 19:28:02 -0500, "John M. Dlugosz"
<john@dlugosz.com> wrote:

>Actually, that's part of the problem -- all the "culture" and advice on-line
>concern ASP.  Very little is said about client-side scripting.

Ah! Naturally, I made the assumption that you were "server-side",

Often, Perl is not considered for browser scripting, because it relies
upon Perl being installed on the client machine. In the Windows world,
this is not by default (unfortunately!). I am considering making it
part of our standard workstation config.

>In my case, I'm using IE as a GUI for Perl.  The script alters the content
>of the page on the fly to interact with the user, as well as saving the end
>result (a report) to a new HTML file.

This instead of Perl/Tk, eh? Interesting...



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

Date: Thu, 12 Aug 1999 01:40:07 +0100
From: "Noel Flanagan" <noelflan@indigo.ie>
Subject: alphabetical listing
Message-Id: <BJos3.2144$r4.1157@news.indigo.ie>

Hi all

I'm relatively new to perl and am looking for advice on how to retrieve
names in alphabetical order  from some form of a database when a page first
loads.

The names in the list which would act as a link to the persons web-site. Is
there any cgi resources with the solution already available?

Any advice would be graciously recieved

Dec




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

Date: 11 Aug 1999 20:13:15 -0400
From: elflord@news.newsguy.com (Donovan Rebbechi)
Subject: Re: Another quick question...Arrays...testing against
Message-Id: <slrn7r44cq.mst.elflord@panix3.panix.com>

On Wed, 11 Aug 1999 20:36:39 GMT, (BXTC) wrote:

>@numbers[0]  =  5

THis is part of your problem. It's $numbers[0].
@numbers[0] would be an array ( which 5 isn't ) 

( barfs at example ) 

# takes two args: an array ref and the search item ( must be a number )

sub contained {
	my $array_ref=shift;
	my $target=shift;
	foreach my $n ( @$array_ref ) 
	{ 
		if ( $target == $n ) { return 1; } 
	}
	return 0;
}

-- 
Donovan


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

Date: 12 Aug 1999 1:13:30 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Another quick question...Arrays...testing against
Message-Id: <786qx@questionexchange.com>

> I
> since have bought the Camel book, and have been reading it and
> learning a
> lot.  I think I am going to really learn it, even just for
> myself not as
> much as for my work.  But I've run into another problem which
> hopefully is
> easy, as I think many people would have to do this.....
> I have an array "@numbers" with values as follows (although the
> $#numbers
> will vary)
> @numbers[0]  =  5
> @numbers[1]  =  9
> @numbers[2]  =  19
> @numbers[3]  =  12
> @numbers[4]  =  6
> And I also have a string $target whose value is....(this also
> will vary)
> $target  =  9 (and it is actually the number of elements in
> another
> array....$#target)
> Now I need to search each value of @numbers to see if ANY of
> them equals
> $target.  I have been reading the book all about arrays, and I
> have learned
> that I can't test it as @numbers because that would test the
> WHOLE array,
> and using slices isn't any better.  I tried doing something
> like this
> my $x = $#numbers - 1;
> while ($x >= 0){
>      if ($#target = $numbers[$x]) {
>           DO_MY_FUNCT();
>      } else {
>           $x - 1;
>      }
> }
> but it didn't work, as it didn't like my syntax and it was
> saying something
> about a useless subtraction, on one of the lines that only had
> "}" on
> it...so that confused me.
> I hope it wouldn't be too much of a pain for you to help me.
> There is no
> rush on this at all, as I have met my bosses time limit(thanks
> totally to
> you all), and am now improving the script for my own
> experience/knowledge.
> And just so you don't think I am just getting you to do my work
> for me
> (although the code I've shown you is probably proof enough as
> it is wrong
> and inefficiant) I have been reading a lot in the perldoc(which
> is hard to
> understand sometimes) and the Camel book(pretty good, but
> leaves some
> questions unanswered), and looking at other people code from
> web sites.
> Thanks for the time you have already spent, and for any more
> you might
> spare.
> Bryce Tate
> Team Unicorn, Inc.
> www.teamunicorn.com

 $x = $x - 1;
or more compactly
 $x--;
The normal way to iterate over arrays in Perl is to go
 foreach $number (@numbers) {
  if ($number == $#target) {
   # do whatever
  }
 }

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2615&cus_id=USENET&qtn_id=1978


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

Date: Thu, 12 Aug 1999 00:01:05 GMT
From: weicai@my-deja.com
Subject: Automatically update web page daily
Message-Id: <7ot2rr$29t$1@nnrp1.deja.com>

Hi, All

Is there anyone know how to write a perl script to check system clock
and execute another perl script once or twice a day automatically in
order to get daily updated web information.

Thanks and have nice day.

Wei


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 11 Aug 1999 17:16:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: CGI Error - CGI application misbehaved
Message-Id: <MPG.121bb219bb8157dc989e3d@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7os1m9$9f9$1@nnrp1.deja.com> on Wed, 11 Aug 1999 14:34:50 
GMT, goparajs@usa.redcross.org <goparajs@usa.redcross.org> says...
> Can Any one can explain this error
> 
> " The Specified CGI application misbehaved by not returning a complete
> set of HTTP Headers. The  headers it returned are : "
 ...

If you want to ask a question in more than one newsgroup, you should 
learn how to cross-post.  If you know how to cross-post, but the crap 
you are using for a newsreader:

X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; 
DigExt)

doesn't let you do it, then get a proper newsreader.

I answered this in comp.lang.perl.modules, more correctly (I think) than 
the two responses here.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 11 Aug 1999 20:17:03 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Comma seperated numbers
Message-Id: <brian-ya02408000R1108992017030001@news.panix.com>

In article <x7d7wt9a1g.fsf@home.sysarch.com>, Uri Guttman <uri@sysarch.com> posted:

> >>>>> "bdf" == brian d foy <brian@pm.org> writes:

>   bdf> what happened when you tired it?
> 
> it called sleep(8*3600).

that's what happens when you exercise code, i guess.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: 12 Aug 1999 1:2:6 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Database conversion
Message-Id: <779qx@questionexchange.com>

> file consisting of patient records. Some of the fields are
> LASTNAME
> FIRSTNAME MIDDLENAME SEX.. I want to output these fields, along
> with their
> values, tab delimited. However, if a particular field is not
> present, i.e.
> MIDDLENAME, an extra tab should be left in its place:
> Patient 1: LASTNAME=Doe    FIRSTNAME=John    MIDDLENAME=Frank
> SEX=M
> Patient 2: LASTNAME=Dave  FIRSTNAME=Mike
> SEX=M
> Please advise on coding for this.
> Sunny

$line = "LASTNAME=Doe ..."
$out = "";
for(qw/LASTNAME FIRSTNAME MIDDLENAME SEX/) {
 if($line =~ /$_=(\S+)/) {
  $out .= $1
 } else {
  $out .= "\t";
 }
 $out .= "\t"
}
$out =~ s/\t$//;
Note that this really puts an extra tab like you asked - if you
just meant that the delimiters should be there, then remove the
first "$out .= "\t"" line.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2606&cus_id=USENET&qtn_id=1955


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

Date: 11 Aug 1999 20:20:27 -0400
From: elflord@news.newsguy.com (Donovan Rebbechi)
Subject: Re: Dereferencing anon hash
Message-Id: <slrn7r44qb.mst.elflord@panix3.panix.com>

On Wed, 11 Aug 1999 14:36:38 -0600, Josh Goodman wrote:

>      #Creating anon hash
>      $database{$_} = {
>                 $i => $abs_digits
>                  };

This does *NOT* create an anonymous hash, and it doesn't create a 
hashref. It creates %database which is a hash. $database doesn't exist.

>my $test;
>#Derefencing one specific database entry by hand for testing purposes.
>$test = %{$database{"crd.9.m0"}} ->{"1"};

*	Your left hand side is a scalar, but the RHS starts with %
( so it's a hash ) 

*	%{hash_name}->{"1"} doesn't make sense. You'd want 
	${hash_ref}->{"1"}

*	The thing inside the curly braces, $database{$key} should
	be a hashref ( but isn't ) 

Play around with data types some more and write some small test programs
or something. This seems very confused.

-- 
Donovan


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

Date: Wed, 11 Aug 1999 18:05:24 -0700
From: Jason Simpson  <jsimpson@haywire.csuhayward.edu>
Subject: embedded SQL
Message-Id: <Pine.SO4.4.05.9908111801030.29354-100000@haywire.csuhayward.edu>


Disclaimer: I am new to perl and know absolutely nothing about SQL.

I realize that, at least to the best of my knowledge, there is no standard
which covers embedded SQL in perl. Can anyone please tell me if this is
possible and where to find resources to guide me. Otherwise we're going to
have to rewrite everything in C ? ? ?


--
Jason Simpson

			<Insert witty comment here>





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

Date: Thu, 12 Aug 1999 00:13:25 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help with -X
Message-Id: <Fkos3.91$gi1.32517@nsw.nnrp.telstra.net>

In article <7ost37$1efgt$1@swen.emba.uvm.edu>,
	jstorer@okapi.uvm.edu (Jason W. Storer) writes:

#!/usr/bin/perl -w
use strict;

> sub GetBusiness { my($Business)=@_;

	my $Business = shift;

> 	$file="$FilesDirectory/business.dat";

	my $file = "$FilesDirectory/business.dat";
	my $data;
	my @record;

> 	if -e $file {

	if ( -e $file ) {

> 		open (bdata, "<$file");

		open (BDATA, $file) || die "Cannot open $file: $!";

> 		while (!eof(bdata) && ($Business ne $record[0])) {
> 			sysread (bdata, $data, 250);
> 			@record=split('~~', $data);
> 		}

Why a sysread instead of a read? Why the eof?

	while (my $numbytes = read(BDATA, $data, 250))
	{
		die "Incorrect read: $numbytes" unless $numbytes == 250;
		@record = split('~~', $data);
		last if $record[0] eq $Business;
	}

	close(BDATA);
}

You do realise that this always returns the last record, even if there
was no match?

> It doesn't like the -e.  What am I doing wrong and how can I fix it?

Well, the -e is superfluous anyway. If you just use open, and check
the return value (which you have to do anyway), then that will tell
you whether the file exists or not. You don't need the -e, and it's
probably more harmful here than useful.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd.       | make up 3/4 of the population.
NSW, Australia                      | 


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

Date: 12 Aug 1999 1:1:24 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Help with -X
Message-Id: <776qx@questionexchange.com>

> -e filetest operator.  Using the syntax shown in the
> perlfunc/_X.html
> manpage, I wrote this code:
> sub GetBusiness { my($Business)=@_;
>  $file="$FilesDirectory/business.dat";
>  if -e $file {
>   open (bdata, "<$file");
>   while (!eof(bdata) && ($Business ne $record[0])) {
>    sysread (bdata, $data, 250);
>    @record=split('~~', $data);
>   }
>   close (bdata);
>  }
>  return @record;
> }
> It doesn't like the -e.  What am I doing wrong and how can I
> fix it?
> Thanks!  -Jason

 if(-e $file) {
  # ...
 }

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2603&cus_id=USENET&qtn_id=1925


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

Date: 11 Aug 1999 19:50:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: is our reese the author of mysql book?
Message-Id: <slrn7r46h9.d88.abigail@alexandra.delanet.com>

Uri Guttman (uri@sysarch.com) wrote on MMCLXXI September MCMXCIII in
<URL:news:x7d7wu9uso.fsf@home.sysarch.com>:
// 
// my $table_data = $dbh->prepare("select * from $table");

[ Rant about bad Perl and DBI usage deleted ]

Not only is the Perl and DBI usage bad, "select * from $table" is
also bad HTML. Of course it's fine for one shot coding, but it
should never, ever appear in production code.

Whenever I review code, anything that uses "select *" gets rejected,
no appeal possible. Not only is it inefficient (as the SQL compiler has
to figure out what * expands to) it also breaks a level of abstraction.

I worked on a project a year and a half ago, that had to be implemented
totally on the database level, no modifications on the application
level. It was implemented totally on the database level - but it broke
each and every application that used "select *" despite the coding
guidelines/rules.



Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 11 Aug 1999 18:30:12 -0600
From: "Edward B. Toupin" <etoupin@toupin.com>
Subject: New Book on Perl Tool Development
Message-Id: <rr45e6eekrl94@corp.supernews.com>
Keywords: Perl, Tools

We are considering publishing a new book about Perl tool development and are
looking for a few people with the right qualifications to review and comment
on the manuscript. If interested, please send an email to etoupin@toupin.com
with a brief description of your credentials and I will send you more
information.


Edward B. Toupin, Review Editor      Phone: (303) 638-7129
Manning Publications Co.                 E-mail: etoupin@toupin.com
32 Lafayette Place
Greenwich, CT 06830                       For more information on Manning
                                                        books, see
www.manning.com





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

Date: Wed, 11 Aug 1999 21:32:22 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: New Book on Perl Tool Development
Message-Id: <7ot65k$qk8$1@plonk.apk.net>


Edward B. Toupin wrote in message ...
>We <snip> are
>looking for a few people with the right qualifications to review and
comment
>on the manuscript.
>

Sounds like a job for Tom C!

Jody




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

Date: Wed, 11 Aug 1999 17:32:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: NO-ONE USES PERLQT !!!!!!!!!!!!!!!!!!!!!?????????????????????????
Message-Id: <MPG.121bb5e84c0c790e989e3e@nntp.hpl.hp.com>

In article <37B1E50B.83A50D4F@mcmahon.qal.berkeley.edu> on Wed, 11 Aug 
1999 14:03:07 -0700, Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu> 
says...
> Thomas M. Schmickl wrote:
 ...
> ... Personally,
> I'm considering setting one up to match anything whose subject line is
> in ALL CAPS or contains 2 or more of the same punctuation mark in a row.

Subject:  What is the difference between /x/ .. /y/ and /x/ ... /y/?

 ...
> > And even guys like hitler denied some
> > part of the population the right of speech and the systematically closed
> > the ears of the majority
> > for the arguments of these (belived) lower human beings. The majority
> > realy thought
> > it had the right to first ignore them, later punish them and afterward
> > kill them.
> > As we all know, this should better not have happend. I am from austia, a
> > land that
> > was part of this regime just a few decades ago, so I am very sensible to
> > all kinds
> > of arrogant totalitarism and censorship.

Now he has already said one of the magic words, so according to Godwin's 
Law this thread should have been over at that point.  Why are we still 
responding?

I think he failed to understand the difference between being killfiled 
by one person and having a message cancelled.  Nothing more.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 11 Aug 1999 17:43:36 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: NO-ONE USES PERLQT !!!!!!!!!!!!!!!!!!!!!?????????????????????????
Message-Id: <MPG.121bb8933912e244989e3f@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37B204E8.3AC0FC59@mail.cor.epa.gov> on Wed, 11 Aug 1999 
16:19:04 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> Thomas M. Schmickl wrote:
 ...
> > And even guys like hitler denied some
> > part of the population the right of speech and the systematically closed
> > the ears of the majority
> > for the arguments of these (belived) lower human beings. The majority
> > realy thought
> > it had the right to first ignore them, later punish them and afterward
> > kill them.
> > As we all know, this should better not have happend. I am from austia, a
> > land that
> > was part of this regime just a few decades ago, so I am very sensible to
> > all kinds
> > of arrogant totalitarism and censorship.
> 
> Well thank you very much.  I happen to be Jewish, with roots
> in Eastern europe and Russia, so I have plenty of deceased
> relatives thanks to those practices.  I find it so charming
> when someone throws nonsense like this in my face.  Don't 
> expect to get replies from me anymore.  That's the
> equivalent of being plonked, anyway.

David, I share your heritage and your sensitivities.  But I don't read 
this as being nonsense.  His English is ragged, so maybe there were 
better ways of expressing his views.  For example, 'As we all know, this 
should better not have happend.' is an egregious understatement, but it 
is nonetheless true.

Mitteleuropeans in particular are still struggling to deal with their 
collective inherited shame and guilt.  I struggle to force myself to 
accept their remorse (but cannot do it for those of them who are older 
than I am).  So let's not damage our own psyches by overreacting.

Anyway, as I said in another post, Godwin's Law would put this thread to 
rest right now.  So let's.
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 11 Aug 1999 17:12:49 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: obtaining local IP address in ActivePerl
Message-Id: <37B21181.1FFEE9F6@mail.cor.epa.gov>

Charles DeRykus wrote:
[snip]
> You mean the following which works on NT doesn't work on Win32/95...
> 
> perl -MSocket 'my $ip=gethostbyname("my_host");print inet_ntoa($ip),"\n"'

Umm, look at this [tested on win98]:

C:\>perl -MSocket -e "$ip=gethostbyname 'localhost'; print inet_ntoa $ip;"
127.0.0.1
C:\>perl -MSocket -e "$ip=gethostbyname 'pcdc1'; print inet_ntoa $ip;"
204.47.148.55
C:\>perl -MSocket -e "$ip=gethostbyname 'jett' ; print inet_ntoa $ip;"
204.47.148.179

Didn't this work on win95 too?  I just don't remember, and I don't
have access to any win95 machines anymore.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 11 Aug 1999 17:15:48 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: obtaining local IP address in ActivePerl
Message-Id: <37B21234.2F89A61B@mail.cor.epa.gov>

Charles DeRykus wrote:
[snip]
> You mean the following which works on NT doesn't work on Win32/95...
> 
> perl -MSocket 'my $ip=gethostbyname("my_host");print inet_ntoa($ip),"\n"'

Oh, I forgot to mention.  This needs some tweaking to run 
on NT or 95/98, since those command processors insist on
having the program in double quotes.  cf. the FAQ, where
TomC complains bitterly about the non-portability of 
one-liners.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Thu, 12 Aug 1999 00:00:19 GMT
From: jatgirl@yahoo.com
Subject: perl -splice - add an element/delete
Message-Id: <7ot2qe$29j$1@nnrp1.deja.com>

I read about splice and I'm still a little confused as to how to use it
with the  array I have .
I have an array whos elements contain hashes. I'm not being able to
figure out the correct way to add or delete hash with in that array

 [ {
      hash1
    }
    {hash 2}
  ]
any ideas on how I can resolve this?
Your help would be greatly appreciated.

Thanks
jatgal


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 12 Aug 1999 1:3:11 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Perl is eating up my memory
Message-Id: <784qx@questionexchange.com>

> of memory and the process is hang up finally.
> I run the script on a SUN Ultra5 with 128M and Solaris. I use
> 'top' command
> to watch how much memory is used.
> The script is quite simple and the array is the only main data
> structure.
> You can try by just filling enough data in an array and watch
> what is
> happening.
> Is the answer that Perl is not suitable to process great amount
> of data?
> Thanks

If you have lots of numbers, I recommend taking a look at the
PDL module for Perl, it is made exactly for the purpose of
handling lots of numerical data.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2610&cus_id=USENET&qtn_id=2044


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

Date: 11 Aug 1999 18:05:43 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: printf vs. sprintf: inconsistent?
Message-Id: <37b20fd7@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    mgjv@comdyn.com.au (Martien Verbruggen) writes:
:This, in my opinion, is broken behaviour, which is probably not that
:easy to fix.  I believe Tom Christiansen posted a FMTEYEWTK about
:prototypes a little while ago (last month or so), which explains
:exactly this. You can probably find it on deja.com or so.

It's the top feature at www.perl.com right now.

--tom
-- 
"Perl is the language of choice for net abuse."         -- Larry Wall


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

Date: Wed, 11 Aug 1999 17:08:17 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Problem reading forms with perl
Message-Id: <37B21071.8921D919@mail.cor.epa.gov>

genelong@my-deja.com wrote:
[snip of Abigail's reply]

> Maybe it's clear to you, Abigail, but not to me.  There is a PDK, a
> PerlDirect, a Perl Development Kit, a Perl Resource Kit, and other
> things.  I tried PerlEx for Win32, but that turned out to be for a
> server, not for a workstation.  I will try downloading other things,
> but I am still shooting in the dark.

Try http://www.activestate.com/ActivePerl/

On the main webpage, it is listed as 'build 518'.

[more snips]
> Give me a break, Abigail.  I DON'T HAVE A MANUAL.  I'm trying to get
> one.  I never heard of the "standard distribution" until a few days ago
> on this list.

Okay, that's one area we can fix.  Once you get the file from
the above URL, click on it, answer a couple simple questions,
and let it put a shortcut on your Start Menu.  Now you have
a button on your Start Menu that you can click to get all the
Perl docs [the FAQ, the ActivePerl FAQ, ...] including what is
labeled as the Core Perl Docs.  These are the manual.  Read
the intro first to get an idea of how to proceed through
them, since they are in alphabetical rather than logical order.

[more snippage]
> I already use Perl.  I edit it with a text editor and ftp it out to my
> web site in the cgi-bin directory, and it runs fine when I access my
> web page.  I don't need command lines to run perl.

But you could if you wanted to.  Perl is good for a lot of 
things besides web programming.
 
> I don't know about your windows, but mine *does* consist of icons and
> screens.  Where do you enter line commands?  In DOS?

No, Abigail uses linux and other unices.  Abigail has windows
which are analogous to your Command Prompt window - the DOS box.
But in unix these windows give one access to a great deal of
power, due to the proliferation of tool programs.
 
> Gee, you're in a bad mood today.  Of course I need perl (the language)
> or I wouldn't be here.  I'm not sure I need perl (the compiler) since I
> have run fine without it up to now.

Abigail is gruff, but fair.  Just let us help you, and don't
get into _ad_hominem_ comments.. even if they come your way.
Please.

Now then, you're getting into a jargon problem.  Perl
[the language] runs through an interpreter and compiler of
a sort to get executed.  There is also a Perl Compiler which
does something different.  So it is easy to get confused by
the technical discussions if you don't know just how Perl
works.

[more snips]
> > --                        I see forms all the time that let users
> enter
> > -- addresses such as "joe <joe@domain.com>".  How do those forms get
> the
> > -- input into some place where it can be manipulated?
> >
> > That's a question that has nothing to do with Perl. Unless you write
> > a browser in Perl.
> 
> I don't understand your comment at all.

You're being told in a terse way that this is a browser issue,
not a Perl issue.  But that doesn't answer your question.  The
best way to handle form data if you're new to Perl is via the
CGI.pm module.  It comes with a wealth of examples showing how
to do a lot of the web tasks you no doubt want to do.
 
[more snips]
> Give me a break.  I said I'm a newbie.  I'm a windows programmer, not a
> unix guru.  I think I've done damn good building a web site from
> scratch when all I knew was C++ to start with.  I'm humbly asking for
> help, cause it's a big world out there, and I've only started to
> scratch the surface.  If you don't want to help, Abigale, just ignore
> my messages.

I sense a lot of cross-connections due to techspeak.  

Well, get build 518, let it install itself, and then you'll be
able to get a lot of your questions answered without having
to put up with us as much.  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 12 Aug 1999 1:2:24 GMT
From: QuestionExchange <USENET@questionexchange.com>
Subject: Re: Problem using last with a label
Message-Id: <781qx@questionexchange.com>

> same email doesnt get placed twice. If an identical email
> is found, I want to exit the foreach loop for efficiency;
> however, before $emailcheck can be assigned a value, last
> is executed prematurely (I assume). If the last function is
> removed, the value is assigned and the loop will continue
> checking records. What's going on?? Code below. Thanks.
> Darryl Dyck
> GetHits.com
> if ($usedb eq '1') {
>    ($day, $month, $year) = (localtime)[3,4,5];
>    $file = $month+1 . "-$day.txt";
> LINE:  open (EMAILCHECK, "dbtst/$file") || die "cant open:
> $!\n";
>           foreach $record (<EMAILCHECK>) {
>              if ($record =~ /^$email\|/) {
>              $emailcheck = 1;
>              last LINE;
>              }
>        }
>   close (EMAILCHECK);
>    if ($emailcheck != 1) {
>      open (EMAILDB, ">>dbtst/$file") || die "cant open: $!\n";
>        print EMAILDB "$email|$url|$title|";
>        printf EMAILDB ("%02d-%02d-%04d", $month+1, $day,
> $year+1900);
>        print EMAILDB "\n";
>      close (EMAILDB);
>    }
> }

LINE: foreach $record...
and not the open command. This may cause strange behaviour.

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet1/showUsenetGuest?ans_id=2609&cus_id=USENET&qtn_id=1968


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

Date: Thu, 12 Aug 1999 10:03:55 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Stripping quotes only from HTML tags
Message-Id: <MPG.121cba7aa8695063989c10@news-server>

Warren Bell writes ..
>I have a messageboard script that I want to strip the quotes out of
>anything within HTML tags that is entered in the text area.  If a quote
>is entered as text like: try the command "foo -a" it woulden't get
>stripped. But anything in between < and > gets the quotes stripped from
>it.
>
>Is there a way to do this with a simple substitution like:
>
>$message =~ s/?/?\g;

well you're a real "roll over and scratch my tummy please" guy aren't 
you .. one day all that "read the documentation" advice will slip 
through the cracks into your brain

*plonk*

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Wed, 11 Aug 1999 20:19:01 -0400
From: brian@pm.org (brian d foy)
Subject: Re: UpperCase first letter of string only.
Message-Id: <brian-ya02408000R1108992019010001@news.panix.com>

In article <MPG.121b97b0c341bb5b989e36@nntp.hpl.hp.com>, lr@hpl.hp.com (Larry Rosler) posted:

> In article <brian-ya02408000R0908992043080001@news.panix.com> on Mon, 09 
> Aug 1999 20:43:08 -0400, brian d foy <brian@pm.org> says...

> > ucfirst() would work, even though it is cryptically named.
> 
> You of all people might have mentioned that this action might be 
> contrary to the wishes of the persons whose names are entered.

maybe i'll hack perl so that any string that might be my name is
changed to one case, and the case shifting functions won't work on
that part of the string. :)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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