[12809] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 219 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 21 20:17:22 1999

Date: Wed, 21 Jul 1999 17:10:10 -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, 21 Jul 1999     Volume: 9 Number: 219

Today's topics:
    Re: HELP: Faster alternative of substr()? (Larry Rosler)
    Re: How to divide output paga to <1> <2> <3> ... ? <rgaushell@hotmail.com>
    Re: macros in perl? (Mike Bristow)
        Need help with setsockopt <dkr@freerealtime.com>
    Re: newbie question: how put files from dir in array (Larry Rosler)
    Re: newbie question: how put files from dir in array (Jerome O'Neil)
        Program Available--2nd Conference on Domain-Specific La (Moun Chau)
    Re: Q: simple glob <baliga@synopsys.com>
    Re: Q: simple glob <baliga@synopsys.com>
        RFC 1867, file upload skao@inteliant.com
    Re: RFC 1867, file upload <flavell@mail.cern.ch>
    Re: Shortening the length of a string (Larry Rosler)
    Re: that great DNS lookup script (Michael Fuhr)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 21 Jul 1999 14:56:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP: Faster alternative of substr()?
Message-Id: <MPG.11ffe1cb72e8f9c5989d13@nntp.hpl.hp.com>

In article <7n5bf8$8v7$1@aquila.tiscalinet.it> on Wed, 21 Jul 1999 
22:46:42 +0200, Marco Cecconi <sklivvz@tiscalinet.it> says...
> hassanov@my-deja.com wrote in message <7n4ife$s5g$1@nnrp1.deja.com>...
> >Regarding huge arrays, is there any better (faster) way to do the
> >following:
> > for($i=0;$i<length($SrcArray);$i++)
> > {
> > $ord1=ord(substr($SrcArray, $i, 1));
> > $ord2=ord(substr($EncryptionArray, $i, 1));
> > substr($DstArray, $i, 1)=chr( $ord1 + ord2 );
> > }
> 
> I think this is much faster... hope it helps!
> 
> BEGIN {
>     $EncryptionArray2='';
>     for ($i=0; $i<255; $i++) {
                    256 ?

>         $EncryptionArray2.=chr($i)
>     }
> }
> .
> .
> .
> $SrcArray=~tr/$EncryptionArray2/$EncryptionArray/;

It may well be much faster.  However, I don't understand the 
relationship of this proposal to the original problem.

If I understand it correctly, there are two strings of equal length, 
which are to be "added" together character by character.  What does 
translation of one set of characters to another have to do with this?

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


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

Date: Wed, 21 Jul 1999 15:24:33 -0700
From: Richard Gaushell <rgaushell@hotmail.com>
To: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: Re: How to divide output paga to <1> <2> <3> ... ?
Message-Id: <379648A1.D24730D2@hotmail.com>

"Yeong Mo/Director Hana co." wrote:
> First,  How to divide output paga to <1> <2> <3> ... as a search result of
> flat db searching  ?

read perlfaq9 and perlfaq7.  heck, read perlfaq 1-9.

> Second,  I am looking for free flat db search script
> which has $ex0, $ex1, $ex2 variables for matching by select option.
> If you have this please let me get it.

I have it!  The exact thing you're looking for!  But this is the wrong 
newsgroup to post this question to.  If you can guess which newsgroup
would be correct and post the answer there, I'll give you the script.

Have fun,
Rich

---------------------------------------------------------------------
Rich Gaushell -- Yet Another Perl Programmer  <rgaushell@hotmail.com>
"Give a person a script, they'll use it for a day,
 Teach them how to program, they can run forever."
(unless they're on NT, in which case they must reboot every few days)



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

Date: Wed, 21 Jul 1999 22:24:32 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: macros in perl?
Message-Id: <slrn7pci50.2st.mike@lindt.fat.dotat.at>

On Wed, 21 Jul 1999 18:03:46 GMT, mda@discerning.com <mda@discerning.com> wrote:
>How does one write a "macro" in perl -- a function whose
>arguments are not evaluated before invoking the caller.

man perlrun or perldoc perlrun

-- 
Mike Bristow, Geek-At-Large.                GK/RM0501
one tequila - two tequila - three tequila - FLOOR !!!



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

Date: Wed, 21 Jul 1999 21:49:09 +0000
From: Doug Robinson <dkr@freerealtime.com>
Subject: Need help with setsockopt
Message-Id: <37964054.E748A4F7@freerealtime.com>

Hello all

I have this program:

#!/usr/bin/perl -w

use strict;
use IO::Socket;

my $IP_ADD_MEMBERSHIP = 35;	# look for this guy in perl stuff!

my $sa = pack "C8", 224, 7, 7, 7, 209, 91, 67, 171;
my $socket = IO::Socket::INET -> new (Proto => 'udp')
  or die "Socket $!";
$socket -> setsockopt (SOL_SOCKET,
		       $IP_ADD_MEMBERSHIP,
		       $sa) 
  or die "setsockopt: $!";

Running this little guy produces the following output:

perl -w catch.pl
setsockopt: Protocol not available at catch.pl line 11.

Compilation exited abnormally with code 92 at Wed Jul 21 15:41:32

To me this means the $IP_ADD_MEMBERSHIP service is not available. Well, 
available to whom? IP_ADD_MEMBERSHIP is available on my system (Linux RH
6.0)
I know because I have it running on C++ programs. I simply
cannot see the problem here!

Help me please!
Thanks for your time and effort!

dkr

-- 
The Office of Doug Robinson.	These types are not "abstract"; they are as
dkr@freerealtime.com		real as int and float. - Doug McIlroy


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

Date: Wed, 21 Jul 1999 15:02:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie question: how put files from dir in array
Message-Id: <MPG.11ffe3568dfb7cb7989d14@nntp.hpl.hp.com>

In article <37963E6A.6A71A59F@mail.cor.epa.gov> on Wed, 21 Jul 1999 
14:40:58 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
 ... 
> @files = grep !/^\.\.?$/, readdir MYDIR;
> 
> or 
> 
> @files = grep !/^\.{1,2}$/, readdir MYDIR;
> 
> Larry Rosler prefers #1, since it has 2 fewer characters.
x
Which is, in fact, exactly what I posted a few minutes earlier!

> And we all want to win at Perl golf.  :-)

Why not?

> Repeat after me: "I am Tiger Woods!"

Repeat after me: "I am not Jean Van de Velde!"

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


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

Date: 21 Jul 1999 22:26:19 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: newbie question: how put files from dir in array
Message-Id: <7n5heb$38m$1@brokaw.wa.com>

In article <MPG.11ffe3568dfb7cb7989d14@nntp.hpl.hp.com>,
	lr@hpl.hp.com (Larry Rosler) writes:
> In article <37963E6A.6A71A59F@mail.cor.epa.gov> on Wed, 21 Jul 1999 
> 14:40:58 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
>> Repeat after me: "I am Tiger Woods!"
> 
> Repeat after me: "I am not Jean Van de Velde!"

Van de Veld, when translated to english, means "Bill Buckner."



-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.i-filezone.com


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

Date: 21 Jul 1999 22:16:41 GMT
From: moun@usenix.ORG (Moun Chau)
Subject: Program Available--2nd Conference on Domain-Specific Languages, October 3-5, 1999
Message-Id: <7n5gs9$epc$1@goldenapple.srv.cs.cmu.edu>
Keywords: USENIX, Domain-Specific languages, ACM, SIGPLAN, SIGSOFT, DSL, languages, design, implementation, software engineering, declarative languages, tools, design principles, object-oriented languages, visual environments, architecture, infrastructure, program analysis, formal methods, type theory, testing/prototyping, unix, research, conference, refereed papers, invited talks, tutorials

*Take part in the community dedicated to promoting the promise
  and practice of domain-specific languages
*Learn of current advances of DSLs and examine the spectrum of
  benefits which DSLs can provide
*Concentrate on the unique aspects of DSL design, DSL
  implementation, and of DSLs as software engineering tools

DSL '99
2ND CONFERENCE ON DOMAIN SPECIFIC LANGUAGES
October 3-5, 1999
Omni Hotel, Austin, Texas, USA
-----------------------------------------------------
Save.  Register by September 13, 1999.
Register on line:  www.usenix.org/events/dsl99
-----------------------------------------------------
Sponsored by USENIX, The Advanced Computing Systems Association
In cooperation with ACM SIGPLAN and ACM SIGSOFT

Refereed Papers Examing the Unique Positive Aspects of DSLs in areas
such as:
* Different Approaches To DSL Construction
* New DSLs For Problem Domains such as Specifying Hardware Circuits
and Robot Control Protocols
* Creating Data-Intensive Web Sites and Collaborative Applications

Keynote:  Towards More Natural Domain-Specific Languages
by Brad A. Myers
Human Computer Interaction Institute, Carnegie Mellon University

Hot Research Reviews
* Domain-Specific Languages for Programming and Security in Active
Networks, by Carl A. Gunter, University of Pennsylvania
* A Methodology for Designing Domain-Specific Languages Using Program
Specialization, by Charles Consel, IRISA/University of Rennes

Insight and Perspective from Invited Talks
* Language Technology for Performance and Security
* The Next 700 Markup Languages

Interactive Sessions, Hosted Luncheon, and Conference Reception

"(Regarding the 1997 DSL Conference) Papers presented were of such
uniformly high quality that the program committee was unable to
single out one for special commendation. Interest in the BOFs was
so great that initial plans to run them concurrently were shelved
in favor of a consecutive schedule.  Overall, I believe the 
conference was a great success!"
Andrew J. Forrest, AT&T Labs






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

Date: Wed, 21 Jul 1999 15:27:59 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Q: simple glob
Message-Id: <3796496F.AA11D94C@synopsys.com>

Enclose the String <$new/*.CSV> in quotes.

-- Baliga

milan andric wrote:

> What is wrong with the glob statement :
>
> open (DATA, "counties.list");
>
> while ($line=<DATA>){
>  chomp ($line);
>
>  if ($line eq "Jo"){$line="jodavies"}
>    elsif($line eq "Rock"){$line="rockisla"}
>    elsif($line eq "St."){$line="stclair"}
>
>         $new=substr("\L$line",0,8);
>         chdir("indexes/$new") || print "can't chdir $!\n";
>         if (<*.CSV>){
> #it doesn't seem to do anything.. @temp is empty.
>         push (@temp, <$new/*.CSV>);}
>         chdir ("../../");
> }
>
> close(DATA);
> print @temp;
>
> a little stuck...
>
> thanks for any help,
> milan



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

Date: Wed, 21 Jul 1999 15:28:41 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Q: simple glob
Message-Id: <37964999.BD4F04E9@synopsys.com>

continuation of the previous post...

   Otherwise it is considered as reading from a file...

-- Baliga

milan andric wrote:

> What is wrong with the glob statement :
>
> open (DATA, "counties.list");
>
> while ($line=<DATA>){
>  chomp ($line);
>
>  if ($line eq "Jo"){$line="jodavies"}
>    elsif($line eq "Rock"){$line="rockisla"}
>    elsif($line eq "St."){$line="stclair"}
>
>         $new=substr("\L$line",0,8);
>         chdir("indexes/$new") || print "can't chdir $!\n";
>         if (<*.CSV>){
> #it doesn't seem to do anything.. @temp is empty.
>         push (@temp, <$new/*.CSV>);}
>         chdir ("../../");
> }
>
> close(DATA);
> print @temp;
>
> a little stuck...
>
> thanks for any help,
> milan



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

Date: Wed, 21 Jul 1999 22:47:14 GMT
From: skao@inteliant.com
Subject: RFC 1867, file upload
Message-Id: <7n5ile$aku$1@nnrp1.deja.com>

Does anyone know of a CGI program that enables form-based file uploading
to a Solaris 2.6?

I've attempted utilizing a simple Perl script, but the file transfer
will only work on ASCII text.  Any help would be appreciated.


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


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

Date: Thu, 22 Jul 1999 01:11:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: RFC 1867, file upload
Message-Id: <Pine.HPP.3.95a.990722011035.17832B-100000@hpplus03.cern.ch>

On Wed, 21 Jul 1999 skao@inteliant.com wrote:

> Does anyone know of a CGI program that enables form-based file uploading
> to a Solaris 2.6?

Does anyone _not_ know CGI.pm?

Of course, you also need a browser that supports it, but neither of
these aspects is a Perl language question.




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

Date: Wed, 21 Jul 1999 15:21:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Shortening the length of a string
Message-Id: <MPG.11ffe7d598c0ce9989d16@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <grrl3.632$Hf6.661@news2.mco> on Wed, 21 Jul 1999 17:58:13 -
0400, Travis Surgnier <surgie@bellsouth.net> says...
> I'm working on a project which outputs several variables from a database.
> One of these is a description which can get rather long. I'd like to know
> how to shorten it to $X characters. I've looked through the perlfaq and
> found nothing, and substr dosn't look to be what I need. If anyone can help,
> it would be greatly appreciated.

What objection do you have to substr?

  $short = substr $long, 0, $X;

A regex can work too, though not as efficiently.

  ($short = $long) =~ s/(.{$X}).+/$1/s;

If $X is constant, add the /o modifier.

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


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

Date: 21 Jul 1999 17:55:27 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: that great DNS lookup script
Message-Id: <7n5mlf$2j9@flatland.dimensional.com>

mfuhr@dimensional.com (Michael Fuhr) writes:

> During one of my tests, I resolved 6959 of 9507 addresses in 225
> seconds, versus only 129 addresses with gethostbyaddr() in the same
> amount of time.

Allowing the gethostbyaddr() script to complete took 4 hours 55
minutes.  This script resolved 7835 of the 9507 addresses; the higher
number of answers is probably due to retries and longer timeouts.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


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

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". 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 V9 Issue 219
*************************************


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