[10151] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3744 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 17 18:07:43 1998

Date: Thu, 17 Sep 98 15:00:33 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 17 Sep 1998     Volume: 8 Number: 3744

Today's topics:
        collecting string padding techniques <uri@camel.fastserv.com>
    Re: Formatting a variable to three digits <uri@camel.fastserv.com>
        Formmail for windows stan_tall_man@hotmail.com
    Re: how safe is xor encryption ? (Michael J Gebis)
    Re: how safe is xor encryption ? (Mark-Jason Dominus)
        newbie - time difference robert.sanford@platinum.com
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses (Jonathan Abbey)
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <mtr@igs.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: perl video games (Sean McAfee)
    Re: Questions about Perl <upsetter@ziplink.net>
    Re: Questions about Perl (Craig Berry)
    Re: Regex strange behavior (Tad McClellan)
        regular expression puzzle (Ralph Brands)
        Seats left: Phila CGI Programming w/ Perl Sep 29... <joseph@5sigma.com>
    Re: trying to use print<<END; with CGI.pm <perlguy@inlink.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 17 Sep 1998 17:51:21 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: home
Subject: collecting string padding techniques
Message-Id: <sar4su68l2e.fsf@camel.fastserv.com>


this is a call to prove TIMTOWTDI is a large value.

postings of how to pad numbers or strings are getting to be an FAQ. we
should add that to the master FAQ. someone asked me (as i expressed
interest in this idea) to write up the faq. i am asking for all you
favorite padding code ideas. i have seen many posted. IIRC randal once
posted 10 new ones but i couldn't find it on dejanews.

i want both right and left justification and 0 and blank (or arbitrary)
pad chars.

so here are some to start the list:

(assume $pad_len is set)

# sprintf doesn't support arbitrary pad chars, just 0 and blank
# note that %d and %s do the same thing so you can left zero pad arbitrary
# strings!

# left padding with 0 

$padded = sprintf( "%0{$pad_len}d", $num ) ;

# left padding with blank 

$padded = sprintf( "%{$pad_len}s", $text ) ;

# right padding with blank

$padded = sprintf( "%{$pad_len}d", $num ) ;

# prepending the pad with x and .

$padded = '0' x ($pad_len - length( $num )) . $num ;

# or right padded version

$padded = $num . '0' x ($pad_len - length( $num )) ;

# or you can right pad $num directly

$num .= '0' x ($pad_len - length( $num )) ;

# prepending the pad using x and substr

$padded = substr( $padded = $num, 0, 0 ) = '0' x ($pad_len - length( $num )) ;

# make the longest possible padded text, then substr to get the
# padded string. this pads on the left

$padded = substr( '0' x $pad_len . $num, -$pad_len ) ;

# same but pad on the right

$padded = substr( $num . '0' x $pad_len , 0, $pad_len ) ;

# modifies $num, pads on right

substr( $num .= '0' x $pad_len, $pad_len ) = '' ;

# pack can blank pad on the right

$padded = pack "A$pad_len", $num ;


uri

-- 
Uri Guttman                             Speed up your web server with Fast CGI!
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 17 Sep 1998 17:12:01 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Formatting a variable to three digits
Message-Id: <sar67em8mvy.fsf@camel.fastserv.com>

>>>>> "JZ" == Jeff Zucker <jeff@vpservices.com> writes:

the idea is valid but the padding code is blecchh!

  JZ> sub decr {
  JZ>   ###################################################################
  JZ>   my($num) = @_;
  JZ>   my($desired_length)=length($num);
  JZ>   if( $num < 1 ) { $num = 1; } # ignore negative numbers
  JZ>   $num--;
  JZ>   my $pad = $desired_length - length($num);
  JZ>   for ( 1 .. $pad ) { $num = "0" . $num; }
  JZ>   return($num); 
  JZ> }

sub decr {
	my($num) = @_;
	my($desired_length)=length($num);
	return 1 if( $num < 1 ) ; # ignore negative numbers

	$num--;

	return '0' x ($desired_length - length( $num ) ) . $num ;

or 
	return sprintf( "%.$desired_length", $num ) ;

there have been many padding algorithms posted but none use a loop for
each char!

uri

-- 
Uri Guttman                             Speed up your web server with Fast CGI!
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Thu, 17 Sep 1998 20:58:13 GMT
From: stan_tall_man@hotmail.com
Subject: Formmail for windows
Message-Id: <6trt55$qmm$1@nnrp1.dejanews.com>

does anyone know where (if one exists) I can find a version of formmail for
windows?  Is there some way to get formmail.pl to work with windows web
servers? thanks, stan

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 17 Sep 1998 20:51:47 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: how safe is xor encryption ?
Message-Id: <6trsp3$q0v@mozo.cc.purdue.edu>


Last night, Mark-Jason Dominus posted a challenge: he encrypted his credit
card number and invited anyone to try to break it.  Here's what I
found trying to do so.

PART I: THE BAD SYSTEM.

Please notice that this thread started with a proposal for an encryption
system which was not secure--I posted code which very quickly ran
a dictionary attack against the original system.  For historical
sake, here's a very quick demonstration of that bad system:

-----------------------------------------------------------------------------
sub badcrypt ($$) {
  my($cc,$key)=@_;
  return $cc^$key;
}
# Prints "X\@QVCE]"
print badcrypt('12345678','insecure');
-----------------------------------------------------------------------------
What's wrong with this sytem?  Well, given only the ciphertext "\[XQ", we
know the following:

The first  letter must be one of "hijklmno`a"
The second letter must be one of "lmnohijkde"
The third  letter must be one of "pqrstuvwxy"
The fourth letter must be one of "a`cbedgfih"
 ...and so on.

If we search the dictonary for words that match this, we find three:

hitherto:05493112
hothouse:03499668
insecure:12345678

The only knowledge about the plaintext we've used is that it is comprised
of only digits, and we're already down to three matches!  

Addmittedly, people would probably choose better passwords, but with
some work, and more knowledge about the form of the plaintext (like it
must be a valid CC#) we could apply the same techniques recursively to
break pass phrases, not just a single word.

This is a bad system.



PART II: The good system.

Mark-Jason Dominus then proposed a new system.  Here's how it works (see
his post for more examples):

If the credit card number is 1234-5678-9012-3456, treat it as a very
large integer, that is, approximately 1.23456*10^15.  (I'm approximating
to convey the size of the number-in the actual implementation, you have
to deal with the number exactly.)  Convert this number to binary, and
then pack that into a seven-digit string.  Xor this string with a
seven-digit key.

Mark-Jason was bold enough to encrypt a real credit-card with a real
dictionary word and post the result.

Well, this system immediately looks better.  We know that credit-card
numbers have 16 digits (we can ignore the ones that don't, since they
seem to be rare) so we can reject any ciphertext/key pair that
gives us a plaintext with 17 digits, and a back-of-the envelope
calculation shows us that lets us eliminate about 30% of the possible
keys right away.  That sounds good, but it really doesn't produce anything
useful.  Applying this to MJD's ciphertext let me eliminate around 10,000
of the 45,000 words in my /usr/dict/words.

We can do better by applying some knowledge about how credit card numbers
are structured.  There is a checksum digit that lets us elminate
a full 90% of the remaining keys.  If we assume it's a well-known
card (visa, mastercard, discover, amex) we can elminate a lot of keys.
Using this knowledge on MJD's ciphertext, we find that we've narrowed
the list of potential keys to 277 (11 of these are mastercard numbers,
266 are visa numbers).

Sounds promising, doesn't it?  We've exhausted our list of rules, but
we've got a relatively short list.

Unfortunately, here's a problem:  given a "random" ciphertext, and using
the same set of rules, we end up with a list of comparable length.  In
other words, applying all of our assumptions to a key that does not
work still gets us a list of about 300 possiblities.  All of our
work was for nothing, really-- we've done a lot of work to generate a list
of plausible credit-card numbers, but not much else.

Let's take another look at this.  Based on the ciphertext posted yesterday,
here are some of the possiblities for key/plaintext pairs.

 ...
domino1,4329669516373071: visa
donatio,4329656498956817: visa
doorbel,4329660540823058: visa
doormen,4329660540757520: visa
dope123,4329682205667661: visa
dove123,4329690795602253: visa
dover12,4329690791211596: visa
dozen12,4329707969770060: visa
drafts1,4359304607871055: visa
dragons,4359304623009037: visa
drained,4359304790713882: visa
 ...

All of these encrypt to the SAME CIPHERTEXT.  From an attacker's point
of view, they are indistiguishable.  And we've made a whole truckload
of assumptions about the key that might not even be true.  As MJD
pointed out yesterday, 277 is a lot of numbers to attempt.

I'm not ready to proclaim this system completely secure--I'm not a
cryptographer, and I may have easily overlooked something.  (Are there
"weak" keys?  Did I forget something?  I'm just some shmoe on the
net for all you know.)  But it does appear that you don't gain anything
by using a dictionary attack on MJD's system, and I don't immediately
see any other flaws.  Once again, the "hire a professional if you
really care" phrase must be hauled out.

PART III: Details.

So, was MJD's key/cc# on my list?  Well, apparently, one of us had a
bug in our implementation, because it did not show up on the list.
(Oddly enough, we both think it's our OWN software.  I'd like to blame
Mark-Jason, but my code is really ugly.) I sent this list of
candidates to MJD last night, and this morning, when he did not see
his CC#, he realized he may have made a mistake and recalculated his
ciphertext.  Unfortunately, he ruined the drama by sending me the
PLAINTEXT of his CC#. 

It is interesting to note that I was immediately able to distinguish
the difference.  This is a reflection of our knowledge about the
structure of the key and the plaintext.

I'm convinced that had our programs been bug free, his number would have
shown up on my list.  I'm also convinced that this really wouldn't have
mattered, because I wouldn't have had enough information to get to a 
smaller list.

----

I sent this off to Mark-Jason for comments before posting, and here's
what he had to say:

I guess I have one comment: I didn't use a program to encrypt the
original number.  I used unix `bc' to convert the 16-digit credit card
number to the binary number, and then I used

perl -le 'print pack "B8 B8 B8 B8 B8 B8 B8", "00001100", "110101010", etc.'

to pack it into 8 characters.  I did it all manually, and that's why I
think I got the wrong answer--it would have been easy to let some
digit slip somehow.  When I did it again this morning, I got

	k\cN\242\324\352\314\372
	[Note from Mike: I can't post 8-bit, so this was converted by
	hand.  I may have mangled it.  Beware.  -MJG]

which is different from what I posted in the last two characters, and
that suggests that it really was my fault, and not yours.  If you want
to mention the correct ciphertext, that would be fine with me.

You might also want to add that the card number was for a closed
account.



-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 17 Sep 1998 17:17:24 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: how safe is xor encryption ?
Message-Id: <6tru94$fo2$1@monet.op.net>

In article <36016B0B.56AF@DejahsPrivateIce.com>,
Mary E Tyler  <dejah@DejahsPrivateIce.com> wrote:
>why 53.15 bits... 

One decimal digit contains the same information as 3.322 binary
digits.  A credit card number is 16 digits long, so it contains
16*3.332 = 53.15 bits of information.  (Less, if you discount for the
check digits.) 

> and how do you have  15% of a bit... 

In exactly the same way that the average family has 2.6 children.



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

Date: Thu, 17 Sep 1998 16:30:39 -0500
From: robert.sanford@platinum.com
Subject: newbie - time difference
Message-Id: <MPG.106b3b78544cac0798968d@news.platinum.com>

i have times from two different sources. the first source is using 
localtime(time) and the second is a list of parameters that include
year, month, day in month, hour, minute, second.

my question is - what is the best way to determine if a certain period 
has elapsed between localtime and time given as parameters? is there a 
way to convert time given as parameters and the time data structure 
into a numeric value (number of seconds since 1970 for example) that i 
can say:
   $timeDiff = $localTime - $paramTime

thanks,

rjsjr


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

Date: Wed, 16 Sep 1998 17:00:32 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <360026F0.136F6AD@min.net>

George Reese wrote:
> 
> Python patterns are the same damn patterns as perl.

I know this was true at some instant in time, as a result of
the importation of code from Perl's regex engine into the Python
core.  Whether that code is kept in sync with the original in
Perl, I don't know.  But unless it is, I think it's safe to say
that Python's regex power lags Perl's, considering the continuing
enhancements being made to it by Perl's developers.

> Zenin wrote:
> : And on the flip side, OO does not make something reusable.
> 
> If it is properly OO, it is very likely to be reusable.

Clearly, reusability is a goal -- not only of OO adherents,
but of all programmers.  OO makes it easier to achieve that
goal, but not by a huge margin.  I think that's why
Patterns have become popular recently.

So Zenin is correct: OO does not automatically imply practical
reusability.


> Java is pure OO. 

No, not really.  One glaring example is that intrinsic data types
are not classes like user-defined classes.  Arrays, for example,
can only hold intrinsic data types.  That's one of the reasons
they had to invent the Vector class.


> Python is close enough.  Python only supports the
> weak encapsulation of data, which is where its OO credentials fall
> apart.  For a scripting language (the way I recommend using Python),
> this is a good design choice.

If "close enough" is good enough for scripting, then one could
easily argue that Perl's OO is "close enough" too.


> OO is not simply a tool.  It is a way of engineering applications from
> the moment you conceive of doing something (in some cases, even
> before) until you actually write the code.  A good OO language is an
> important tool in maintaining the OO paradigm across the process.
> 
> Zenin wrote:
> : Perl gives you the freedom to take or leave OO at any time as best
> : fits the particular part of the task at hand.
> 
> That is a freedom that has no place in an OO language.  You do not
> combine a structured software engineering process with a weak link.

Your entire argument rests on the purported supremacy of OO as
a software engineering paradigm.  While I agree that OO is great
stuff, I don't believe it's the panacea that some people (Bertrand
Meyer, e.g.) say it is.  OO has its place.  GOTO has its place.


> Zenin wrote:
> : While Perl is not pure OO, it is very easy to write highly OO
> : Perl code.  Just as easy in fact as Python and just as "OO" as
> : Python, if not more so.

Hmm, I didn't see your response to this particular assertion.
I'm not sure I agree with Zenin, but it would be interesting to
see some concrete support for one side or the other of this
argument.


> It is like sticking a pipe with a huge leak inside your plumbing.

That analogy is utterly specious and invalid.

> Perl is quite simply no where as OO as python.

True; but you think that means Perl is no where near as *good* as a
consequence.  But that does not follow, because OO is not the be-all,
end-all you seem to think it is.


> Be careful of the examples you choose.  In OO circles, C++ is
> considered to be about the worst example of OO available.

This illustrates my point that "OO circles" and the real world of
software development are not entirely synoptic.  C++ is pretty
well entrenched, and when it passes away, then I'll start worrying
about the moribundity of Perl.


> That is because OO is 'not simply a tool'.  Because of the structured
> nature of the OO software engineering process, you need a language
> that enforces your structure.

That's entirely the wrong perspective.
You need a language that *enables* your structure/design/methodology.

-- 
John Porter


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

Date: 17 Sep 1998 16:17:48 -0500
From: broccol@arlut.utexas.edu (Jonathan Abbey)
Subject: Re: Perl & Java - differences and uses
Message-Id: <6tru9s$64p@csdsun1.arlut.utexas.edu>

In article <360026F0.136F6AD@min.net>, John Porter  <jdporter@min.net> wrote:
| > Java is pure OO. 
| 
| No, not really.  One glaring example is that intrinsic data types
| are not classes like user-defined classes.  Arrays, for example,
| can only hold intrinsic data types.  That's one of the reasons
| they had to invent the Vector class.

That turns out (*cough*) not to be the case.  In Java, arrays can
indeed be defined to hold intrinsics, but they can also be defined to
hold instances of any defined type of object.

Vectors are there to provide dynamically sizable arrays, to allow
deletions in the middle, to provide a bunch of methods for finding
elements, performing enumerations, etc.

One thing Vectors can't do is hold unwrapped intrinsics.  Vectors can
only deal with objects.

| -- 
| John Porter

-- 
-------------------------------------------------------------------------------
Jonathan Abbey				              jonabbey@arlut.utexas.edu
Applied Research Laboratories                 The University of Texas at Austin
-------------------------------------------------------------------------------


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

Date: Wed, 16 Sep 1998 17:44:42 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <3600314A.BACCF758@min.net>

George Reese wrote:
> 
> I clearly believe strongly in the OO way of life.

Yes, quite.

> I believe the results speak for themselves.

When someone says "the results speak for themselves", he has
made deductions from the results via some process  -- whether
consciously or unconsciously.

1. "The results" are not well-defined.  No doubt you are only
considering evidence collected by the pro-OO party.

2. Not everyone would apply the same processes to derive meaning
from "the results", and would not reach the same conclusions you
have.


> Here is a test though.  Get someone who has a
> month of experience with each language.  Ask each one to accomplish
> the same task in their language.  I guarantee the perl, C, and C++
> code will always come out more obfuscated than the python or Java
> code.

You "guarantee"?

Among other things, you clearly overestimate the difference between
C++ and Java, wrt what the resulting code would look like.



> Freedom has no place in programming.  Period.

Ah, now we get down to brass tacks.

Your philosophical position is very tenuous indeed, and very
difficult to defend.  Even Meyer won't back you up on that one.


> [Whitespace] is evil in Makefiles because Makefile distinguish between
> whitespace and tabs.  Please explain what the issue is with python?

Whitespace is a class of characters comprising space (020), newline
(015),
linefeed (012), and tab (011).

Just how long have you been in this business really, George?


> Perl is just chaos.

You're a liar.  I'd accuse you of mere ignorance, but I know you know
better, because, as you say,

> I have slightly more perl experience than python experience.



> OO is the single best path to code reuse.

No, sorry.  OO is not a path.  It's a single stepping-stone,
and not the final one, at that.



> : : Java is pure OO.
> 
> : Java has primitive types, therefore by strict OO thinking it
> : is *not* "pure" OO.
> 
> That has nothing to do with pure OO.  Pure OO is defined by data
> abstraction, inheritance, polymophism, and encapsulation.

You can dismiss these faults of Java, but they underlie the
exact reason why Java is not pure OO.
By using the data types *built into the language*, you are not
programming in a purely OO style.
If you think Java is pure OO despite this, you're out on a limb.
Even Gosling won't save you.

By the way, who is the certification authority for OO Purity?
If it's Sun, then I guess I stand corrected.


> Perl, on the other hand, enforces nothing in the object realm.  It
> simply allows it.

That is as it should be.  But on this we disagree.


> It is very convenient to insult everyone not as skilled at you at
> programming, but the fact is that the more people you can make
> productive in programming, the more work you can get done.  And the
> more work you can get done, the more money you make.

Interesting point -- one which explains the burgeoning popularity
of Perl nicely.  Whereas Python was designed to implement some
ivory-tower ideal, Perl was designed to enable people to get work
done, even with a minimum investment in learning the language.

-- 
John Porter


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

Date: Wed, 16 Sep 1998 17:47:24 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <360031EC.4E298F4F@min.net>

Felix S. Gallo wrote:
> 
> The indefatigable George Reese writes:
> >Freedom has no place in programming.  Period.
> 
> Here we discover the crux of the problem: George Reese
> believes that hilariously nonsensical dogma, stated in an
> authoritative way, is a feasible substitute for a forebrain.
>[...]

Brilliant, Felix, absolutely right on; My Man!

-- 
John Porter


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

Date: Wed, 16 Sep 1998 17:54:08 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <36003380.9F1D006F@min.net>

Patricia Shanahan wrote:
> 
> Joseph Kesselman (yclept Keshlam) wrote:
> >
> > Patricia Shanahan wrote:
> > > I don't think the popularity of C can be used as evidence of its
> > > technical goodness
> >
> > The problem: Define "technical goodness".
> 
> Doesn't matter. Whatever it is, I don't think you can deduce it from
> C's popularity alone, because of the non-technical factors that have
> influenced C's popularity.

You can deduce *some* degree of technical goodness, because without
it, all the non-technical factors in the world wouldn't result in
C having the popularity that it has had.  Look at ADA and PL/1 for
examples: huge non-technical forces (the DoD and IBM, respectively)
were unable to make people use those languages.

-- 
John Porter


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

Date: Thu, 17 Sep 1998 21:51:40 GMT
From: "Michael T. Richter" <mtr@igs.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <MvfM1.13$5Z.43200@198.235.216.4>

John Porter wrote in message <3600314A.BACCF758@min.net>...
>> It is very convenient to insult everyone not as skilled at you at
>> programming, but the fact is that the more people you can make
>> productive in programming, the more work you can get done.  And the
>> more work you can get done, the more money you make.

>Interesting point -- one which explains the burgeoning popularity
>of Perl nicely.  Whereas Python was designed to implement some
>ivory-tower ideal, Perl was designed to enable people to get work
>done, even with a minimum investment in learning the language.

Interestingly I've had the opposite experience.  I encountered perl(4) and
loved it.  I used it as my Swiss Army Language for many applications and
off-the-cuff utilities.  Then I encountered Python and never looked back.
Why?  Because I can pretty much trivially read any Python code that wasn't
deliberately obfuscated.  I can't do the same thing for perl: looking at
normal perl code that wasn't written by me has always been a decoding task.

--
Michael T. Richter    <mtr@ottawa.com>    http://www.igs.net/~mtr/
          PGP Key: http://www.igs.net/~mtr/pgp-key.html
PGP Fingerprint: 40D1 33E0 F70B 6BB5 8353 4669 B4CC DD09 04ED 4FE8




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

Date: Wed, 16 Sep 1998 17:56:04 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <360033F4.5CAE903D@min.net>

Cees de Groot wrote:
> 
> >George Reese writes:
> >>Freedom has no place in programming.  Period.

> I tend to agree with George...
> Freedom does have a place in programming...

Double-talk.


> I'm not an academic, by the way (what a strange notion that only academics
> would have good ideas on programming ;-}).

Indeed.  That's why we shouldn't let them dictate to us
on the (alleged) supremacy of OOP.

-- 
John Porter


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

Date: Wed, 16 Sep 1998 17:58:05 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <3600346D.33A38A46@min.net>

George Reese wrote:
> 
> It seems my claim that freedom has no place in programming has really
> struck a nerve with several perl programmers.

It should strike a nerve with every programmer, of every language.

Furthermore, the fact that it strikes anyone's nerve is not --
contrary to what you would construe -- support for your position.

-- 
John Porter


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

Date: Thu, 17 Sep 1998 21:34:29 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: perl video games
Message-Id: <FffM1.3415$F7.13170779@news.itd.umich.edu>

In article <36016E62.5EC1AC0@gaming-age.com>,
Adam Ziegler  <Adamz@gaming-age.com> wrote:
>Would it ever be possible to program video games with PERL, even simple
>ones?

It's possible now, and has been for a while.  For example, Sriram
Srinivasan's book "Advanced Perl Programming" contains code for a Tetris
game, using the Tk module.

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Thu, 17 Sep 1998 21:02:07 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Questions about Perl
Message-Id: <jNeM1.130$_c5.1115295@news.shore.net>

Twan Kogels <888twan@888nlweb.com> wrote:

: 1) i want to test my perl script locally, do i need a server? and
: which server is the best. I'm using win95

You do not need a server to test your scripts locally, but you'll need to
install perl on your local machine. 

: 2) which version of perl should i use?

The latest one! :)

: 3) are there any good online tutorials?

Yes. Sorry I can't provide any specific links but searching on yahoo or
www.perl.com should turn up a few. If you can drop a few bucks, picking up
the book "Learning Perl" (or the Win32 version) will probably do you no
harm (both versions published by O'Reilly & Associates).

: 4) are there any free IDE's or just handy editors for perl?

I use TextPad on Windows and BBEdit on Mac, but everyone's got their own
favorite.

Good luck!

--Art

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 17 Sep 1998 21:19:23 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Questions about Perl
Message-Id: <6trucr$2lk$2@marina.cinenet.net>

Twan Kogels (888twan@888nlweb.com) wrote:
: I'm planning to learn pearl,

The name is 'Perl', no 'a'.

: i have experience with c, c++, java and the win32 API.

The C experience will be most useful; Perl uses a lot of ideas from that
language.

: I have some questions about pearl, here they come :
: 
: 1) i want to test my perl script locally, do i need a server? and
: which server is the best. I'm using win95

No, you don't need a server.  Many perl scripts have nothing to do with
the Net.  And even those that do can be tested locally if you do things
right (e.g., using CGI.pm for CGI apps).

: 2) which version of perl should i use?

5.004_04 is the latest officially approved, stable version.  5.005 series
builds are out there, but not necessarily ready for prime time yet.

: 3) are there any good online tutorials?

Many.  Start at www.perl.com and explore.  Also, every perl installation
package comes with extensive online docs, including the complete FAQ. 

: 4) are there any free IDE's or just handy editors for perl?

There are some, as I recall, but most Perl folk I know seem to prefer
using a simple programming-oriented text editor (PFE or Emacs, in my case) 
and executing from the command line. 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Thu, 17 Sep 1998 16:04:40 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regex strange behavior
Message-Id: <8htrt6.l7a.ln@metronet.com>

Tk Soh (r28629@email.sps.mot.com) wrote:
: filippomorelli@my-dejanews.com wrote:
: > 
: > $tag = '<FOO';
: > $line = '<FOO_BAR></FOO_BAR>junk';
: > 
: > $line =~ /($tag.*)>/;
: > print "Found [$1]\n";
: > 
: > This will print out, [<FOO_BAR></FOO_BAR]. What I want is [<FOO_BAR]. It
: > seems that .* matches all the characters up until the last occurance of the
: > remaining expression (which is the above case, is simply a greater than
: > character '>').

: Well, I trust you will read the free manual as others told you to. So,
: here the quick answer to your question:

: 	$line =~ /($tag[^>]*)/		# matching stop before 1st '>'


   $line = '<FOO_BAR ATTRIBUTE=">>here<<">';
   $tag = 'FOO_BAR';
   print "::$1::\n" if $line =~ /($tag[^>]*)/;  # matching stop before 1st '>'


   output:

   ::FOO_BAR ATTRIBUTE="::


   That answer only works sometimes.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 17 Sep 1998 21:38:38 GMT
From: brinton@unixg.ubc.ca (Ralph Brands)
Subject: regular expression puzzle
Message-Id: <brinton-1709971430070001@p003.intchg3.net.ubc.ca>

I have a text file in which some characters are coded by bounding them
with "&" and ";" so that:

&ae;
&d;
&t;         are all characters

w&ae;nt
&ae;llum    are both words


If I want to search for strings that contain both of two regular
expressions as separate words I do the substitution below. But this
matches string1 only if there is more than 1 space between "&ae;nt" and
"dog"! Any suggestions as to how I can change the regular expression
substitution to get around this would be gratefully appreciated,

Ralph Brands 



#!/usr/bin/perl

$firstregexp = "&ae;nt";
$secondregexp = "dog"; 
   
$string1 = "a string with &ae;nt dog and other words";
$string2 = "a string with &ae;nt and dog";

#to match separate words only if new word boundary condition is met:

$firstregexp =~ s/$firstregexp/(^|[^a-z&;])$firstregexp([^a-z&;]|\$)/gi;
$secondregexp =~ s/$secondregexp/(^|[^a-z&;])$secondregexp([^a-z&;]|\$)/gi; 

print "$firstregexp\n";
print "$secondregexp\n";

print "LINE 1 MATCHES\n" if ($string1 =~ /($firstregexp).*($secondregexp)/); 
print "LINE 2 MATCHES\n" if ($string2 =~ /($firstregexp).*($secondregexp)/);


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

Date: Thu, 17 Sep 1998 14:52:53 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Seats left: Phila CGI Programming w/ Perl Sep 29...
Message-Id: <360184B5.7C64959D@5sigma.com>

I have a handful of seats left in my CGI Programming with Perl class
in the Philadelphia area (Moorestown NJ) from Sep 29-Oct 2.  If you
are interested in attending, see:

  http://www.perltraining.com/schedules.html

for more information.

There's also another introductory and advanced Perl class (not CGI)
scheduled in October.

	-joseph

--
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Thu, 17 Sep 1998 11:27:36 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: trying to use print<<END; with CGI.pm
Message-Id: <3600F228.199789F@inlink.com>

Al Smith wrote:
> 
> it's not working and i can't find any examples anywhere:
> Lincoln's
> metronet
> Perllang
> CPAN
> 
> Am i not looking hard enough?

print<<END;

Al,
  What is it doing?  Just saying that
  it is not working _without_ a code 
  sample doesn't help us troubleshoot
  the problem.

Brent

END
^^^ Notice that this is _all the way on the left_ AND _there is nothing
else on the line!_
-- 
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 3744
**************************************

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