[17146] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4558 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 9 03:05:44 2000

Date: Mon, 9 Oct 2000 00:05:13 -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: <971075113-v9-i4558@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 9 Oct 2000     Volume: 9 Number: 4558

Today's topics:
    Re: $$Perl Programmer wanted for internet based company (David H. Adler)
    Re: about ssh (Gwyn Judd)
        Can I sort a list of hashes by key value? 13_hellfish@my-deja.com
    Re: Can I sort a list of hashes by key value? (Randal L. Schwartz)
    Re: Can perl replace my VBA? (Logan Shaw)
    Re: Comparing Perl and Java (Gwyn Judd)
    Re: Defining Headers for Module Mail::Mailer <dhighley@mail.highley-recommended.com>
    Re: emacs written in perl? (Gwyn Judd)
    Re: emacs written in perl? (Rafael Garcia-Suarez)
    Re: error in mapping array slice <r28629@email.sps.mot.com>
        Generate and save HTML file within a script? <one@two.com>
    Re: Generate and save HTML file within a script? (Logan Shaw)
    Re: Generate and save HTML file within a script? <bugfixxer@yahoo.com>
        generating random number w/ specified bit size (Jorg Ziefle)
    Re: generating random number w/ specified bit size (Logan Shaw)
    Re: Not Entirely On Topic:  Programming and math (Eric Bohlman)
    Re: Number of matches (Logan Shaw)
    Re: Numeric processing problem. <jondecamp@home.com>
    Re: Numeric processing problem. (Randal L. Schwartz)
    Re: Perl Books! (Ilya Zakharevich)
    Re: Perl compiler (Martien Verbruggen)
    Re: PP, 3rd ed.??? (Eric Bohlman)
        Putting a Perl Interpreter into my App <fire.hydrant@home.com>
    Re: Putting a Perl Interpreter into my App (Logan Shaw)
    Re: Reverse by paragraphs - NOT! (Eric Bohlman)
    Re: string substitution (brian d foy)
    Re: string substitution <celliot@tartarus.uwa.edu.au>
    Re: string substitution <anmcguire@ce.mediaone.net>
    Re: string substitution (brian d foy)
    Re: string substitution (brian d foy)
        variable problems j2lab@my-deja.com
    Re: variable problems (Martien Verbruggen)
    Re: What does $++ mean? <one@two.com>
        Where can I find more information of perldoc HTML::Pars <carfield@my-deja.com>
    Re: Where can I find more information of perldoc HTML:: (brian d foy)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 9 Oct 2000 04:43:02 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: $$Perl Programmer wanted for internet based company$$
Message-Id: <slrn8u2j6m.n30.dha@panix6.panix.com>

On Sun, 8 Oct 2000 11:44:40 -0400, M.E. <me@menet.com> wrote:
>I am looking for someone who lives in Long Island, New York who has
>knowledge of Perl and MYsql DB for internet based company. Knowledge of
>html, java not required but a definite Plus!

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :)  (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

There is a Perl Jobs Announce list that may be more helpful to you.  See
<http://www.pm.org/mailing_lists.shtml> for details.

Yours for a better usenet,

dha


-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"In my opinion, there's nothing in this world beats a '52 Vincent and
a red headed girl" - James Adie


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

Date: Mon, 09 Oct 2000 04:28:47 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: about ssh
Message-Id: <slrn8u2ibr.8h9.tjla@thislove.dyndns.org>

I was shocked! How could Warren Brown <treetops@worldonline.co.za>
say such a terrible thing:
>Put an xterm -e in front.
>ie`xterm -e ssh www.xxxx.com df -k`;

Have you even *heard* of Perl or did you come in here by mistake? By the
way if you intend to post here you should put your replies below the
text you are replying to, like I am here.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I hope something GOOD came in the mail today so I have a REASON to live!!


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

Date: Mon, 09 Oct 2000 04:52:28 GMT
From: 13_hellfish@my-deja.com
Subject: Can I sort a list of hashes by key value?
Message-Id: <8rriub$79q$1@nnrp1.deja.com>

I have a list of hashes defined as:

$fish[0] = {
 name => 'trout',
 type => 'rainbow'
};

$fish[1] = {
 name => 'bass',
 type => 'large-mouth'
}

$fish[2] = {
 name => 'bass',
 type => 'small-mouth'
};

I would like to sort the list (array @fish) by fish name.  If more than
one fish have the same name, then it should further be sorted by type.
Is this posssible?  If so, how?  Is there a better data structure I
should be using?  I chose the list of hashes for it's readabilty.  It's
pretty easy to see what I'm doing when I can see the name in the
variable. $fish[1]{name} is obviously fish #2's name.

Thanks for any help or suggestions.



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


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

Date: 08 Oct 2000 22:10:12 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Can I sort a list of hashes by key value?
Message-Id: <m18zry38i3.fsf@halfdome.holdit.com>

>>>>> "13" == 13 hellfish <13_hellfish@my-deja.com> writes:

13> I would like to sort the list (array @fish) by fish name.  If more than
13> one fish have the same name, then it should further be sorted by type.
13> Is this posssible?  If so, how?  Is there a better data structure I
13> should be using?  I chose the list of hashes for it's readabilty.  It's
13> pretty easy to see what I'm doing when I can see the name in the
13> variable. $fish[1]{name} is obviously fish #2's name.

I'll throw you a fish here[1], and say this:

    @sorted_fish = sort {
      $a->{name} cmp $b->{name}
        or
      $a->{type} cmp $b->{type}
    } @fish;

There.  Hope that helps.

print "Just another Perl hacker,"

[1] Give a man a fish, he eats for a day.  Teach a man to fish, he
    eats for a lifetime.

    Give a man a fire, he's warm for a day.  Set a man on fire, he's
    warm for the rest of his life.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 9 Oct 2000 01:12:15 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Can perl replace my VBA?
Message-Id: <8rrnjv$agb$1@provolone.cs.utexas.edu>

In article <8rrd2v$sg$1@news.NERO.NET>,
Jeff D. Hamann <hamannj@ucs.orst.edu> wrote:
>Here's what I need to be able to do:
>
>1) use/make arrays of user defined data types.

Perl doesn't actually have user-defined data types in the same way that
other languages have.  But, what it does have is objects.  The objects
can define a data type (in a sense) by only allowing you to access the
data through the interface.  It's not exactly the same thing as type
checking, but you can solve the same problems with it.

If you're talking about a specific binary layout of your data, then
Perl can do this with pack(), although it can be a bit ugly.  (But,
what you'd do -- or at least I'd do -- in that case is define an object
and give it a method so that it knows how to create and decode the
proper binary representation of itself when necessary.)

In short, without knowing what you need specifically, I think it's
pretty likely that Perl can do what you want without big problems,
although it may turn out that Perl's way of doing it is not what you
expect.

>2) pass these arrays to DLLs or loadable library modules

Do you mean binary loadable or Perl's own loadable library modules?  In
any case, it should be possible either way.  There are ways to somewhat
conveniently make Perl bindings to external code and load it
dynamically.

>3) interface with databases

Perl has this area covered.  To access any given database, you'll need
two modules.  The (generic) DBI module allows you to access databases
in general, and then the database-specific DBD module is a driver.  So,
for example, you need DBI and DBD::mysql to access MySQL.

>4) be able to detect performace bottlenecks to improve process

Perl has a profiler module (Devel::DProf), although it's not part of
the standard distribution.

>5) multithreading would be nice

Perl doesn't have (as far as I know) ready-for-prime-time thread
support.  It's being worked on, though.

>6) start process and KNOW it will finish without hanging on some messgage
>box.

"Message box" meaning pop-up window that requires user intervention?
If so, then this won't be a problem since you'd have to excplicitly
create such a window.

>7) be able to run it on both Win32 and *nix

That shouldn't be a problem -- Perl runs on lots and lots of
platforms.

>8) be able to generate web pages to indicate progress (newbie question)

Well, if you run a Perl script as a CGI, that one script is only going
to generate *one* web page, so it will be hard to generate a series of
them to give progress updates.  That's not a Perl problem -- it's how
the web works (you get a web page, and then the session is done).
However, you could certain have Perl periodically spit out an HTML
file into a pre-defined place that summarizes the progress so far.
You could then periodically re-load that web page and get an idea of
how far along it is.  This would be more useful in a situation where
your process is taking a long period of time to do what it does.

>I would like to hear some suggestions regarding how other people generate
>tons of data from simulations and handle the output as well. Most of what
>I'm doing is generating data for combinatorial analysis problems and would
>like to have something flexible enough to ease the pain of maintainence just
>short of completely coding the stuff in C (even the DLLs are in Fortran 90).

I don't have much experience with that, but gosh, I guess
I'd be strongly inclined towards throwing it all into a
database.  (But it sounds like that's what you've done
already, so maybe I'm not understanding the question.)

One thing you should be aware of is that if you're planning to load
large amounts of data into memory, perl can be a bit of a memory hog.
Storing 100,000 integers in memory is going to take more space with
Perl than with compiled, native-level languages like C or (I assume)
Fortran.  Perl has a certain amount of overhead per data item.  For
small things like integers, I believe the overhead can be over 100%.

One other thing you might be interested to know about is PDL.
PDL is a (modular) Perl extension that adds "the ability to
COMPACTLY store and SPEEDILY manipulate the large N-dimensional
data sets which are the bread and butter of scientific
computing".  It has the ability to read file formats like
NetCDF and stuff like that too.  See http://pdl.perl.org/ .

Hope that helps.

  - Logan


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

Date: Mon, 09 Oct 2000 04:22:06 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Comparing Perl and Java
Message-Id: <slrn8u2hvb.8h9.tjla@thislove.dyndns.org>

I was shocked! How could Jan Schaumann <jschauma@netmeister.org>
say such a terrible thing:

>I reckon you're the funny guy in this NG?

Only on tuesdays

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Remember that whatever misfortune may be your lot, it could only be
worse in Cleveland.
		-- National Lampoon, "Deteriorata"


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

Date: Sun, 08 Oct 2000 22:32:54 -0700
From: David Highley <dhighley@mail.highley-recommended.com>
Subject: Re: Defining Headers for Module Mail::Mailer
Message-Id: <39E15886.9B5EBD36@mail.highley-recommended.com>

Tony Curtis wrote:

> >> On Sun, 08 Oct 2000 11:41:48 -0700,
> >> David Highley <dhighley@mail.highley-recommended.com> said:
>
> > Can someone give me an example of how to define the
> > headers when using the module Mail::Mailer created bye
> > Tim Bunce. I have looked at the interface and also
> > compared what I have done with other mailing modules,
> > but sendmail keeps telling me I need to define the
> > Recipient.
>
> What have you tried so far?  It's rather difficult to say
> what's wrong if you don't show code.

%headers= (
    to => 'dhighley',
    subject => 'Checkin Report',
);
$mailer->open(\%headers);

or

%headers{to} = 'dhighley';
%headers{subject} = 'Checkin Report';
$mailer->open(\%headers);

>
>
> hth
> t

--

Regards,

David Highley
Highley Recommended, Inc.
2927 SW 339th Street
Federal Way, WA 98023-7732

Phone: (206) 669-0081
FAX:   (253) 838-8509
Email: dhighley@highley-recommended.com
WEB:   http://www.highley-recommended.com





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

Date: Mon, 09 Oct 2000 04:23:39 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: emacs written in perl?
Message-Id: <slrn8u2i27.8h9.tjla@thislove.dyndns.org>

I was shocked! How could Randy Harris <harrisr@bignet.net>
say such a terrible thing:
>Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
>news:39E0BC89.9E777B68@stomp.stomp.tokyo...
>> Godzilla!
>> --
>
>Isn't this a bit off-topic?

She specialises in it. Get used to it, or killfile her.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Power corrupts, and absolute power corrupts absolutely.


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

Date: Mon, 09 Oct 2000 06:50:57 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: emacs written in perl?
Message-Id: <slrn8u2r3g.d7s.rgarciasuarez@rafael.kazibao.net>

Mike Eggleston wrote in comp.lang.perl.misc:
>
>I suppose what I'd really prefer is a vi written in perl so that I could
>access the underlying interpreter.

On the other hand, vim <www.vim.org> can be compiled with a embedded
perl interpreter.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Mon, 09 Oct 2000 14:42:26 +0800
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: error in mapping array slice
Message-Id: <39E168D2.46E0A052@email.sps.mot.com>

Ren Maddox wrote:
> 
> Tk Soh <r28629@email.sps.mot.com> writes:
> 
> > the original intention was to build an array from another with a minimum
> > number of elements, or "pre-fill" with "" if element value is undefined.
> > My two-line alternative works, but I thought using map would make the
> > code more perl'ish:
> >
> >    @this_array = map {defined? $_ : ''} @that_array[-10, -1];
> 
> My take on this is that you want to copy the last 10 elements of
> @that_array into @this_array, but that if there are fewer than 10
> elements in @that_array, then they should go at the end of
> @this_array.
> 
> So if @that_array contains (1, 2, 3, 4, 5, 6), then after the copy
> @this_array will contain (undef, undef, undef, undef, 1, 2, 3, 4, 5,
> 6).  Is that correct?

Correct, except I then need to map all undef's to empty string. 
Sorry I didn't make it clear enough.

> If so, then this should do it (though I certainly don't promise that
> it is the *best* way):
> 
> @this_array = ((undef) x 10, @that_array)[-10 .. -1];

Guess I just found the asnwer:

@this_array = map {defined $_? $_ : ''} 
                  ((undef) x 10, @that_array)[-10 .. -1];

Thanks to everyone, appreciate it.

-TK


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

Date: Mon, 9 Oct 2000 01:30:06 -0500
From: "Easy Wind" <one@two.com>
Subject: Generate and save HTML file within a script?
Message-Id: <8rrop0$ua1$1@flotsam.uits.indiana.edu>

I'm trying to figure out how to generate html within a perl script, and then
have that product saved as a different file.  For example, let's say I want
to make a customized greeting card.  The user would first use the design
page, where the user enters their email address, name, what message they
want sent, etc.

Now, I have no problems generating a page that displays the user's message
and other customizations, but how do I take that page they created and save
it in another directory, and do that within my perl script?  I'm sure it's
possible, just don't know how to do it.

Any of you have a method of doing this, or can point me to a place that has
that info?


    -Easy




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

Date: 9 Oct 2000 01:52:03 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Generate and save HTML file within a script?
Message-Id: <8rrpuj$auh$1@provolone.cs.utexas.edu>

In article <8rrop0$ua1$1@flotsam.uits.indiana.edu>,
Easy Wind <one@two.com> wrote:
>Now, I have no problems generating a page that displays the user's message
>and other customizations, but how do I take that page they created and save
>it in another directory, and do that within my perl script?  I'm sure it's
>possible, just don't know how to do it.

"perldoc -f open".

  - Logan


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

Date: Mon, 9 Oct 2000 10:45:06 +0400
From: "Andrew Tkachenko" <bugfixxer@yahoo.com>
Subject: Re: Generate and save HTML file within a script?
Message-Id: <8rrq33$6ip$1@arcom.rcom.spb.su>

I think you should open file, select it's filehandle for output and print
html code.
Look at "select" function in perl manual.

Easy Wind <one@two.com>  
:8rrop0$ua1$1@flotsam.uits.indiana.edu...
> I'm trying to figure out how to generate html within a perl script, and
then
> have that product saved as a different file.  For example, let's say I
want
> to make a customized greeting card.  The user would first use the design
> page, where the user enters their email address, name, what message they
> want sent, etc.
>
> Now, I have no problems generating a page that displays the user's message
> and other customizations, but how do I take that page they created and
save
> it in another directory, and do that within my perl script?  I'm sure it's
> possible, just don't know how to do it.
>
> Any of you have a method of doing this, or can point me to a place that
has
> that info?
>
>
>     -Easy
>
>




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

Date: 9 Oct 2000 05:45:17 GMT
From: gt4556a@prism.gatech.edu (Jorg Ziefle)
Subject: generating random number w/ specified bit size
Message-Id: <8rrm1d$djj$1@news-int.gatech.edu>

For a crypto algorithm implementation, I need to generate a "true" random number with a pre-specified bit size.
E.g., "create a random number whose binary representation is $size digits long".

Here is what I have come up with. Basically, it generates a bit vector by iterating $size times and generating a random bit at the corresponding position by the following procedure:
* using Math::TrulyRandom to get a truly_random_value()
* calculates the cross sum of it
* if the cross sum is even, the bit is 0, otherwise 1

Then, the bit vector is transformed in a Math::BigInt value. This is necessary cause a reasonable $digits for the algorithm is about 200 to 400 ;)

My question is: As the below is horribly slow, does anybody have a better idea for the problem and/or can my code be written more elegant/efficient (pack/unpack, ...)?

Any help is greatly appreciated ( before I start pluggin' in the same in C via XS ;) ).

################################################

use Math::BigInt ':constant';
use Math::TrulyRandom ;
use POSIX;

my $size = 128;

$|++;

sub generate_n {

    my ($size) = @_;
    my $v = '';
    vec($v, 0, 1) = 1;
    print '.';
    
    foreach my $number (1 .. $size - 1) {
	
	my $r = abs(truly_random_value());
	my $sum;
	foreach my $digit (split //, $r) {
	    
	    $sum += $digit;
	    
	};
	
	vec($v, $number, 1) = ($sum % 2 == 0 ? 0 : 1);
	print (($number + 1) % 10 == 0 ? $number + 1 : '.');

    };

    $v = substr(unpack('b*', $v), 0, $size);
    print "\nrandom bit vector: ", $v, "\n";
    my $n = Math::BigInt->new('0');
   
    my $i = 0;    
    foreach (reverse split(//, $v)) {
	
	$n += $_ * (2 ** $i++);

    };

    return $n;
    
};


my $n = generate_n($size);
print "2 ** @{[$size - 1]} = ", 2 ** ($size - 1), "\n", '$n = ', $n, "\n", "2 ** $size = ", 2 ** $size, "\n";

################################################
































-- 
Jorg Ziefle
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: gt4556a@prism.gatech.edu


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

Date: 9 Oct 2000 01:48:11 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: generating random number w/ specified bit size
Message-Id: <8rrpnb$atp$1@provolone.cs.utexas.edu>

In article <8rrm1d$djj$1@news-int.gatech.edu>,
Jorg Ziefle <gt4556a@prism.gatech.edu> wrote:
>Here is what I have come up
>with. Basically, it generates
>a bit vector by iterating
>$size times and generating a
>random bit at the
>corresponding position by the
>following procedure:
>
>* using Math::TrulyRandom to get a truly_random_value()
>* calculates the cross sum of it
>* if the cross sum is even, the bit is 0, otherwise 1
>
>My question is: As the below
>is horribly slow, does
>anybody have a better idea
>for the problem

Well, looking at the documentation for Math::TrulyRandom, it has a
comment that "the random numbers take a long time (in computer terms)
to generate".

So, I'd say a good place to start is by not collapsing all those good
random bits into just one random bit.  I don't know how many bits
TrulyRandom gives you, but let's say it gives you exactly 8 bits.
In that case, you could probably use it with vec() like this:

	$bitsneeded = 41;
	$offset = 0;
	$vector = '';

	while ($bitsneeded >= 8)
		{
		$one_byte = truly_random_value();

		vec ($vector, $offset, 8) = $one_byte;

		$offset++;
		$bitsneeded -= 8;
		}

	if ($bitsneeded > 0)
		{
		# we need a smaller number of bits than 8;
		# handle the special case here.
		}

That's not tested by any means, but it is the general idea.

Hope that helps.

  - Logan


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

Date: 9 Oct 2000 05:29:09 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Not Entirely On Topic:  Programming and math
Message-Id: <8rrl35$qem$3@news.enteract.com>

Logan Shaw <logan@cs.utexas.edu> wrote:
> Don't ask me to explain it.  I can't, and besides that I'd
> rather not think of that horrible job any more than I already
> have.  The point is that one can indeed can get better at mental
> tasks by just doing things that are sort of related to them.

Probably related is the fact that learning a second (human) language tends
to increase one's proficiency with one's first language; I suspect that
this applies to programming languages as well.



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

Date: 9 Oct 2000 01:26:23 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Number of matches
Message-Id: <8rroef$akj$1@provolone.cs.utexas.edu>

In article <971063245.847539@pizza.crosslink.net>,
Collin Borrlewyn <collin@crosslink.net> wrote:
>So... how can I get a
>regexp to tell me how many matches were found?

Do a "perldoc perlop", but briefly the matching operator will,
if you give the "g" modifier, either return all the matches
(in a list context) or return one as long as the pattern
keeps matching (in a scalar context that you keep evaluating.

So, if you want to know how many times the word "mode" occurs in
/etc/termcap, do something like this:

	open (TERMCAP, "/etc/termcap");
	$termcap = join ("", <TERMCAP>);	# yeah, I know, inefficient...
	close TERMCAP;

	$matches = 0;
	$matches++ while $termcap =~ /mode/ig;

	print "'mode' occurs $matches times.\n";

Alternatively, if you cared about the matches, you could just get a
list of them and find the size of the array storing that list:

	open (TERMCAP, "/etc/termcap");
	$termcap = join ("", <TERMCAP>);	# yeah, I know, inefficient...
	close TERMCAP;

	@matches = $termcap =~ /mode/ig;
	$matches = @matches;

	print "'mode' occurs $matches times.\n";

Hope that helps.

  - Logan


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

Date: Mon, 09 Oct 2000 06:32:34 GMT
From: Jon DeCamp <jondecamp@home.com>
Subject: Re: Numeric processing problem.
Message-Id: <39E16779.58593083@home.com>

Unfortunately that's what makes this so hard.  It is only known that there is a
way to do it, and that those six digit numbers are generated *somehow* from the
11 digit ones.  All I can offer further are more 11/6 digit pairs, because I have
plenty.

-Jon DeCamp

"Randal L. Schwartz" wrote:

> >>>>> "Jon" == Jon DeCamp <jondecamp@home.com> writes:
>
> Jon> My thanks (in advance) to any advice that can lead to the completion of
> Jon> this puzzle.
>
> The first step is to answer for us... who determined that 15902621045
> should become 928649?  If that was you, what rule did you use?  If
> that wasn't you, go ask them what the rule is.  And why do you have 11
> digits becoming six?
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



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

Date: 08 Oct 2000 23:34:38 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Numeric processing problem.
Message-Id: <m11yxq34ld.fsf@halfdome.holdit.com>

>>>>> "Jon" == Jon DeCamp <jondecamp@home.com> writes:

Jon> Unfortunately that's what makes this so hard.  It is only known
Jon> that there is a way to do it, and that those six digit numbers
Jon> are generated *somehow* from the 11 digit ones.  All I can offer
Jon> further are more 11/6 digit pairs, because I have plenty.

Then you should go to sci.crypt instead.  That's not a Perl question
any longer.  Beware.  They'll probably laugh at you.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 9 Oct 2000 04:27:58 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Books!
Message-Id: <8rrhge$719$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Elaine Ashton 
<elaine@chaos.wustl.edu>],
who wrote in article <B606A47F.7A8C%elaine@chaos.wustl.edu>:
> Yes, scanning in text from a book without permission from the publisher is
> theft. In the first few pages of any book is the copyright page that usually
> includes such text as 'may not be reproduced without the consent of the
> publisher'.

C'mon, and a lot of software packages are marked as "if you open this,
you agree to ...".  Whatever the publisher puts after the title page
is not binding.

You know quite well that in a lot of situations "scanning in text from
a book without permission from the publisher" it not only legal, it is
moral too.  

BTW, I do not know, is putting "Far side" cartoons in the *out side*
of the door of your office a copyright infringement?  It is not that
far from putting it on Internet...

Ilya



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

Date: Mon, 09 Oct 2000 05:42:52 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Perl compiler
Message-Id: <slrn8u2mmh.2ce.mgjv@verbruggen.comdyn.com.au>

On Mon, 09 Oct 2000 03:42:54 GMT,
	vivek@cse.iitd.ernet.in <vivek@cse.iitd.ernet.in> wrote:
> Can you please guide me to a perl compiler.

http://www.perl.com/
http://www.cpan.org/
http://www.activestate.com/

HTH, HAND

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: 9 Oct 2000 05:34:56 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: PP, 3rd ed.???
Message-Id: <8rrle0$qem$4@news.enteract.com>

David Steuber <nospam@david-steuber.com> wrote:
> Isn't 'malice' a noun?  Oh, but I forget.  We in the computer business
> turn nouns into verbs or adjectives all day long.  That's what we do.

YM "We in the computer business verb nouns and adjective them all day
long."



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

Date: Mon, 09 Oct 2000 04:06:08 GMT
From: Adrien Guillon <fire.hydrant@home.com>
Subject: Putting a Perl Interpreter into my App
Message-Id: <39E05E24.BF0CE268@home.com>

	Hi everyone,

	I'm building a system that is going to require an interpreter, so that
users can create their own programs to modify the system, and to have
the system execute the user's own scripts. I want to have something up
and running soon, so I went to Perl since it's open source. I've been
browsing through the source code, but it's going to take me a long time
to learn the layout of perl (reading other peoples source isn't my
strong point).
	So, what I want to do is put a perl interpreter into my own system. I'm
not quite sure how one would do this, thus I came here... I'm looking
for any helpful advice or web links. A big issue is diskspace, I want my
scripts to be very tiny... very very tiny... perl saves the source file
as ASCII and then interpets them, right? (My Perl programming experience
is fairly limited, though I have done a little bit...) I need to change
say an "if" statement to a single byte in the file, rather than the
two... so that all commands will have their own byte code, and the
modified interpreter will read this byte as if it read the ASCII "if"
from the file, then consult a table and say "this is an if statement, go
here..." ... basically I'm just tweaking it slightly... it kind of makes
it un-Perl-like, but I need it to be this way to save resources...

	I'm mostly looking for documents helping with what in the code does
what, and basically how the files in the source interact with each
other, and what does what, so that I know where to start modifying
source. Any help that anyone can give me would be much appreciated.

	I thank you for your time.

	Adrien Guillon


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

Date: 9 Oct 2000 01:34:09 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Putting a Perl Interpreter into my App
Message-Id: <8rrot1$aoj$1@provolone.cs.utexas.edu>

In article <39E05E24.BF0CE268@home.com>,
Adrien Guillon  <fire.hydrant@home.com> wrote:
>	So, what I want to do is put a perl interpreter into my own system. I'm
>not quite sure how one would do this, thus I came here... I'm looking
>for any helpful advice or web links.

If you have the perl distribution installed on your system, type the
command "perldoc perlembed" and you'll find a document that tells "how
to embed perl in your C program".

> A big issue is diskspace, I want my
>scripts to be very tiny... very very tiny... perl saves the source file
>as ASCII and then interpets them, right?

Right.  Every time a Perl script is run, the perl
interpreter re-interprets it (in the sense of repeating
the process -- not changing the results) from scratch.
It does (from what I understand) get compiled into a
byte-code type thing, but this is never written to disk.

> (My Perl programming experience
>is fairly limited, though I have done a little bit...) I need to change
>say an "if" statement to a single byte in the file, rather than the
>two... so that all commands will have their own byte code, and the
>modified interpreter will read this byte as if it read the ASCII "if"
>from the file, then consult a table and say "this is an if statement, go
>here..." ... basically I'm just tweaking it slightly... it kind of makes
>it un-Perl-like, but I need it to be this way to save resources...

Well, if you need to scrimp and save bytes that much, you may find that
the Perl interpreter is too big for you anyway.  But, if you don't,
then I actually suggest that you just use a predefined compression
format.  That is, compress the scripts with ZIP or something.  There
are Perl modules to do this for you; you could store the scripts ZIPped
and then uncompress them on the fly.

>	I'm mostly looking for documents helping with what in the code does
>what, and basically how the files in the source interact with each
>other, and what does what, so that I know where to start modifying
>source.

If I understand correctly, the Perl interpreter is modular and has
support for being embedded.  You shouldn't have to (or want to) modify
the Perl source; you should able to just link it with your code.
(Someone will correct me if I'm wrong, I'm sure...)

Hope that helps.

  - Logan


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

Date: 9 Oct 2000 05:18:54 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Reverse by paragraphs - NOT!
Message-Id: <8rrkfu$qem$2@news.enteract.com>

ollie_spencer@my-deja.com wrote:
> FWIW:Less than 2 years ago I was severely criticised for posting
> non-jeopardy fashion(i.e., my new message "at bottom") in company
> e-mails! The execs like their meat upfront, I guess.

Important distinction here.  Company e-mails aren't part of an ongoing
conversation.  It's a rare organization where a subordinate would be
expected to routinely pick apart a superior's memo
point-by-point.  Posting comments at the top and then enclosing a copy of
the original post is the equivalent of writing some notes on paper,
clipping them to a copy of the original memo, and returning it, which is
in fact the normal paper procedure.

But a Usenet discussion is a peer-to-peer conversation, not a series of
announcements with limited opportunities for feedback.  What works in the
latter case doesn't work in the former case.  In a face-to-face
conversation, one brings up the point one is replying to *before*
replying, and you have a dialogue rather than a sequence of alternating
monologues.  The conversational milieu demands an interspersed,
reply-after-quote, trim-excessive-quotes style.  Much of the motivation
for quoting an entire communication in company e-mail is CYA.  You don't
need to do that here.



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

Date: Mon, 09 Oct 2000 00:12:28 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: string substitution
Message-Id: <brian-ya02408000R0910000012280001@news.panix.com>

In article <39e13d6f$0$27594@echo-01.iinet.net.au>, "Cameron Elliott" <celliot@tartarus.uwa.edu.au> posted:

> I want to be able to remove the following from a string:
> 
> all { and }'s


> any \ followed by any chars or numbers except
> 
> \ followed by s followed by numbers and    ie.  \s23   \s43
> \ followed by cell                                   ie.  \cell
> 
> basically I have a string and want only the words without \ infront of them
> plus \cell and \s23 (any number) and also want to remove all { and }'s.

it would be easier to do this with some sample input :)

perhaps you are trying to do something like:

   #!/usr/bin/perl
   
   while( <DATA> )
      {
      s{ (\\ \S+) }{ my $x = $1;
                        $x =~ m/^\\s\d+$/ || $x =~ m/^\\cell$/ ? $x : '' 
                   }xeg;

      s# [}{] ##xg;
   
      print;
      }
   
   __END__
   1. this is a {string}
   2. this }is {a string
   3. this \s34 \sio string \{cell}
   4. this \s34 \sio string \cell
   5. this \s 34 \s1 string \scell
   6. \this \s{34} \s1 \string \cell

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


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

Date: Mon, 9 Oct 2000 12:20:10 +0800
From: "Cameron Elliott" <celliot@tartarus.uwa.edu.au>
Subject: Re: string substitution
Message-Id: <39e147cd$0$27597@echo-01.iinet.net.au>

|
| it would be easier to do this with some sample input :)

well this is what I am dealing with (RTF)

}\pard\plain \s92\qc
\li0\ri0\sa80\sl-220\slmult0\widctlpar\intbl\faauto\rin0\lin0
\f5\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\revised Summary
Interrupt\cell }\pard\plain \s102\qc
\li0\ri0\sa80\sl-220\slmult0\widctlpar\intbl\faauto\rin0\lin0
\f5\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033
{\cell }\pard\plain \s78\ql
\li0\ri0\sa80\sl-220\slmult0\widctlpar\intbl\faauto\rin0\lin0
\f5\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {Cell
Buffer }{\revised Top Interrupt Summary Register\cell }\pard


and this is what I want
=>
\s92 Summary Interrupt\cell \s102 \cell \s78\ Cell Buffer Top Interrupt
Summary Register\cell

thanks







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

Date: Mon, 9 Oct 2000 00:06:14 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: string substitution
Message-Id: <Pine.LNX.4.21.0010090004540.16178-100000@hawk.ce.mediaone.net>

On Mon, 9 Oct 2000, Cameron Elliott quoth:

CE> I think this is pretty complex and any help would be greatly appreciated.
CE> I have tried but cant find a way to do it without looping through the string
CE> many times...(and that still doesn't work)
CE> ------------------
CE> I want to be able to remove the following from a string:
CE> 
CE> all { and }'s
CE> 
CE> any \ followed by any chars or numbers except
CE> 
CE> \ followed by s followed by numbers and    ie.  \s23   \s43
CE> \ followed by cell                                   ie.  \cell
CE> 
CE> basically I have a string and want only the words without \ infront of them
CE> plus \cell and \s23 (any number) and also want to remove all { and }'s.

First let me say that I am not a regex guru, so this may be better
answered by someone else.  However:

tr/}{//d;
s/\\(?!s\d+|cell)\w+//g;

Works for me, provided your string is in $_.

anm
-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'



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

Date: Mon, 09 Oct 2000 01:22:19 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: string substitution
Message-Id: <brian-ya02408000R0910000122190001@news.panix.com>

[missing citation to my earlier post.  no matter - i reproduce
the code in this post]

In article <39e147cd$0$27597@echo-01.iinet.net.au>, "Cameron Elliott" <celliot@tartarus.uwa.edu.au> posted:

> | it would be easier to do this with some sample input :)
> 
> well this is what I am dealing with (RTF)

> }\pard\plain \s92\qc
> \li0\ri0\sa80\sl-220\slmult0\widctlpar\intbl\faauto\rin0\lin0
> \f5\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\revised Summary
> Interrupt\cell }\pard\plain \s102\qc
> \li0\ri0\sa80\sl-220\slmult0\widctlpar\intbl\faauto\rin0\lin0
> \f5\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033
> {\cell }\pard\plain \s78\ql
> \li0\ri0\sa80\sl-220\slmult0\widctlpar\intbl\faauto\rin0\lin0
> \f5\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {Cell
> Buffer }{\revised Top Interrupt Summary Register\cell }\pard

aside from whitespace issues, the code i posted earlier does the 
job with a minor change to handle sequences without interstitial
whitespace:

   #!/usr/bin/perl
   
   $/ = undef;
   
   while( <DATA> )
      {
      s{ (\\ [^\s\\]+) }{ my $x = $1;
                         $x =~ m/^\\s\d+$/ || $x =~ m/^\\cell$/ ? $x : '' 
                        }xeg;

      s# [}{] ##xg;
      s/\s+/ /g;
      print;
      }
   
   __END__


> and this is what I want

> \s92 Summary Interrupt\cell \s102 \cell \s78\ Cell Buffer Top Interrupt
                                              ^ that shouldn't be there, 
                                                right?
> Summary Register\cell

and indeed, this is what i get:

 \s92 Summary Interrupt\cell \s102 \cell \s78 Cell Buffer Top Interrupt Summary Register\cell

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


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

Date: Mon, 09 Oct 2000 01:30:57 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: string substitution
Message-Id: <brian-ya02408000R0910000130570001@news.panix.com>

In article <Pine.LNX.4.21.0010090004540.16178-100000@hawk.ce.mediaone.net>, "Andrew N. McGuire " <anmcguire@ce.mediaone.net> posted:

> On Mon, 9 Oct 2000, Cameron Elliott quoth:

> CE> I want to be able to remove the following from a string:
> CE> 
> CE> all { and }'s
> CE> 
> CE> any \ followed by any chars or numbers except
> CE> 
> CE> \ followed by s followed by numbers and    ie.  \s23   \s43
> CE> \ followed by cell                                   ie.  \cell
> CE> 
> CE> basically I have a string and want only the words without \ infront of them
> CE> plus \cell and \s23 (any number) and also want to remove all { and }'s.

> tr/}{//d;
> s/\\(?!s\d+|cell)\w+//g;

that \w won't do the trick.  it only matches word characters, but you
need to match more than that.  remember the the definition of "word"
is a bit fuzzy being that it is a common, um, word.

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


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

Date: Mon, 09 Oct 2000 03:56:47 GMT
From: j2lab@my-deja.com
Subject: variable problems
Message-Id: <8rrflu$4u2$1@nnrp1.deja.com>

I'm new at perl and I'm having some problems with variables.
Currently, I have a form that accepts your information and then opens
up a new page.  When an item is selected on this page, I want the
information from the first form to be used for my variables in the new
page.

I have got this to work when I keep everything on one page.  The
problem is I don't want people to have to scroll down.  Is this
possible?  Would this be easier to do in java?



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


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

Date: Mon, 09 Oct 2000 05:47:09 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: variable problems
Message-Id: <slrn8u2mui.2ce.mgjv@verbruggen.comdyn.com.au>

On Mon, 09 Oct 2000 03:56:47 GMT,
	j2lab@my-deja.com <j2lab@my-deja.com> wrote:
> I'm new at perl and I'm having some problems with variables.

# perldoc perldata

> Currently, I have a form that accepts your information and then opens

My information? How did you get my information? It's mine! I want it
back!

> up a new page.  When an item is selected on this page, I want the
> information from the first form to be used for my variables in the new
> page.

Aha... you are talking about a CGI application, and you want to use
Perl, right?

Use the CGI module. It will more or less do all this automatically for
you. any recent Perl installation comes with the CGI module installed.

# perldoc CGI

> I have got this to work when I keep everything on one page.  The
> problem is I don't want people to have to scroll down.  Is this
> possible?  Would this be easier to do in java?

Huh? What does scrolling have to do with it? And one page?  And if you
don't want people to have to scroll down, then don't output too much
stuff. And even that won't guarantee anything.

I'd say it's probably easier with Perl and the CGI module than with
Java, as long as you're talking about a CGI application. Otherwise it
depends. On many things.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


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

Date: Mon, 9 Oct 2000 01:22:56 -0500
From: "Easy Wind" <one@two.com>
Subject: Re: What does $++ mean?
Message-Id: <8rrobj$u88$1@flotsam.uits.indiana.edu>

yeah, but you can't add or subtract from nothing.  If it was $i++, fine.
But not $++, that's just plain wacky...it's not a variable.






"( dr0id )" <dr0id@webtv.net> wrote in message
news:26980-39E1247A-47@storefull-611.iap.bryant.webtv.net...
> heh i always though ++ meant an increment
>
>
> example : ++$blah; or $blah++;
>




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

Date: Mon, 09 Oct 2000 05:01:04 GMT
From: Carfield Yim <carfield@my-deja.com>
Subject: Where can I find more information of perldoc HTML::Parser?
Message-Id: <8rrjef$7lp$1@nnrp1.deja.com>

After I read the perldoc of HTML::Parser, I still not get how to use
this package, and my testing code don't work at all. Can anyone tell me
where can I find more information of using HTML::Parser?


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


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

Date: Mon, 09 Oct 2000 01:32:16 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Where can I find more information of perldoc HTML::Parser?
Message-Id: <brian-ya02408000R0910000132160001@news.panix.com>

In article <8rrjef$7lp$1@nnrp1.deja.com>, Carfield Yim <carfield@my-deja.com> posted:

> After I read the perldoc of HTML::Parser, I still not get how to use
> this package, and my testing code don't work at all. Can anyone tell me
> where can I find more information of using HTML::Parser?

search for various examples posted in this forum or look at the code
for the subclasses that use HTML::Parser.

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


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

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


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