AW: regex for html img... tags

2002-03-20 Thread Pense, Joachim



[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]

 Frankly, I doubt that's true. There's a obfuscated C contest, but that
 doesn't make people think C is inherently obfuscated.

People *do* think it is. 

 Abigail

Joachim



Re: AW: regex for html img... tags

2002-03-20 Thread Bernard



On Wed, 20 Mar 2002, Pense, Joachim wrote:

 [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]

  Frankly, I doubt that's true. There's a obfuscated C contest, but that
  doesn't make people think C is inherently obfuscated.

 People *do* think it is.

  In my experience the single most confusing aspect of Perl to beginners
is the need to use $, @, and % in front of variable names. They don't see
the beauty in it and some get downright angry when they learn that to
access an array element you have to use $array[2] instead of @array[2], or
to access a hash element you'd use $hash{key} instead of %hash{key}.
  The regular expressions don't help much either. :-)


Cheers,
Bernard
--
echo 42|perl -pe '$#=Just another Perl hacker,'




Why perl is difficult [Was Re: regex for html img... tags]

2002-03-20 Thread cizaire_liste

Messed up my reply, sorry Jeremy...

Jeremy Zawodny wrote:
 
 On Wed, Mar 20, 2002 at 06:49:08PM +1100, [EMAIL PROTECTED] wrote:
 
  These guys seem to think if it is not if-then-else, it is
  weird. Sigh.
 
 So what is it, really, about Perl that makes it so different from
 other languages.
 

My experience as trying to teach perl to my teammates :

 Much Perl code that I've read looks less like Java, C++, Python, or
 VB.  It tends closer to C, Shell, awk, sed, etc.
This may be due to the fact that perl object is an horror due to 
the lack os syntax suggar :
my $this = shift;
$this-{'foo'} = 'bar';
my $this = bless {}, shift  etc
(I admit I did not follow how it is now in post 5.005_03)
use base, our, use fields, etc may helps put perhaps it is a little late

 
 Is it the regular expressions?  
This really looks hackward to most people : maybe the problem is 
in the documentation : perl is a langage by itself whithout RE :
RE may be presented as something optional in the documentation of perl.

 The MTOWTDI?  
This is definetely a problem for new users... in any language...

An other point is that 'advanced feature' of perl are so clean/efficent
that any good perl programmer will tend to use them often, leading
to a program that will need a big amount of perl knowledge to understand
thus it may disgust the beginner perl coder,
(you may think about :
- RE 
- schwatrzian transform
- AUTOLOAD
- eval {} and eval 
)

Just my contribution :)

_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re: Why bother with separate lists?

2002-03-20 Thread F . Xavier Noria

On Wed, 20 Mar 2002 11:33:52 +0800
byron [EMAIL PROTECTED] wrote:

:  I say keep it as one list and have folk learn to use the machinery their 
:  mail clients provide them with; that's why mail clients HAVE that 
:  machinery.
: 
: or, write their own mail client in perl (guilty as charged) ;)

Of course, the fewer strokes the better.

-- fxn




Re: regex for html img... tags

2002-03-20 Thread Bernie Cosell

On 19 Mar 2002, at 23:57, Jeremy Zawodny wrote:

 So what is it, really, about Perl that makes it so different from
 other languages.

The primary 'different' for me is the fact that Perl has *TWO* types of 
expressions: scalar expressions [just like every other programming 
language] and *list* expressions [like very few].  Being able to deal 
with lists is VERY slick and makes for some beautiful and compact 
solutions to problems that other languages have to struggle with.

  /Bernie\
-- 
Bernie Cosell Fantasy Farm Fibers
mailto:[EMAIL PROTECTED] Pearisburg, VA
--  Too many people, too few sheep  --  



Why perl is difficult [Was Re: regex for html img... tags]

2002-03-20 Thread Matthew Winn

On Tue, Mar 19, 2002 at 11:57:19PM -0800, Jeremy Zawodny wrote:
 So what is it, really, about Perl that makes it so different from
 other languages.
 
 Much Perl code that I've read looks less like Java, C++, Python, or
 VB.  It tends closer to C, Shell, awk, sed, etc.
 
 Is it the regular expressions?  The MTOWTDI?  The use of - instead
 of .?  All the funny characters?

Regular expressions never worried me, having grown used to them in vi.
- wasn't a problem either, and I preferred its visual distinctiveness
to the almost invisible . used for OO programming elsewhere.  Nor were
all the funny characters or the use of $array[1] instead of @array[1] a
problem.  In fact I liked most of the things which are traditionally
considered bad about Perl.

The parts of Perl which did bother me at first were:

$_.  I felt much happier with named variables, and didn't really trust
that a language which set $_ when I expected it to do so wasn't also
going to fiddle with it behind my back.

Formats.  Having grown up on languages which have few restrictions on
code layout I didn't like the idea of painting a picture of the desired
output.  I used printf instead.

Modules not distributed with the core system.  It didn't seem quite
right using an extension; it felt too much like the sort of thing I used
to do in my Z80 and MP/M programming days when I'd peek around in the
running OS to get the information I wanted if there wasn't a standard
function to fetch it.

Conditions at the end of statements.  Before Perl the only trailing
condition with which I was familiar was C's do{}while construct and
it took some time to shake off the belief that the condition would be
executed last.

Things I loved about Perl right from the start:

Regular expressions, -w, hashes, lists, dynamically sized strings and
arrays, -w, sort, and the fact that for simple tasks I could have a
working Perl solution in less time than it took me to type

#include stdio.h
int main(argc, argv)
int argc;
char* argv;
{

-- 
Matthew Winn ([EMAIL PROTECTED])



Re: regex for html img... tags

2002-03-20 Thread Chris Dolan

[EMAIL PROTECTED] wrote:
 [snip]
 It's like saying ice-fishing is part of the American culture, just
 because a bunch of people in Alaska do that in winter.

Point taken, but just to nitpick your choice of analogies, it is clear 
that you have never lived in the upper Midwest of the US, or you would 
know that you cannot truly be an American if you have never ice-fished. 
  :-)

Please see Dave Barry's recent column as the definitive exposition on 
ice fishing as a crucial element of our culture.
http://www.miami.com/mld/miamiherald/living/columnists/dave_barry/2779904.htm

All the talk of the Antarctic ice shelf in the news today probably has 
many of my neighbors drooling with envy, now that all of the local lakes 
have thawed.

Chris




Re: regex for html img... tags

2002-03-20 Thread Bill -Sx- Jones

On 3/20/02 12:12 AM, Randal L. Schwartz [EMAIL PROTECTED] wrote:

 original twistyness has devolved to Obfuperl, and *that* has
 contributed to people thinking that Perl is really inherently
 obfuscated, which undermines what *I* would like to see how Perl is
 perceived in the marketplace.  So it may have backfired.  Maybe

This strength of Perl is it's weakness, no question; I have to warn my
students, in a constructive manner, that Perl could be written to appear to
done thing but yet do something unexpected.

Not dangerous per se, but like the occasional snowboarding spill, broken
bones may be part of the fun.  :)


 Obfuperl would have been come about some other way, but I'm sure my
 JAPHs were a contributing factor.



Nah...  It was fate.

-Sx-  :]





My Own Fun with Perl

2002-03-20 Thread Michel J Lambert

Fun with perl? I hope you don't mind if I get up on the stage for a minute
to sell my wares of what was fun for me.

First up, there's NoMoreBraces (renamed from BraceBeGone), that lets you
code Perl with all the benefits and problems with Python's whitespace
compiler. I mentioned this on fwp before, but it was deep in a thread, and
probably ignored. I apologize if you don't find whitespace-sensitivity to
be fun.

I'm not sure if I should submit this under the Acme namespace, or as a
legit package (good package names wanted, privately).

http://www.perl.com/braces/

But wait, theres' more! I've also got a feature-ful Perl Regex Debugger
implemented, in pure perl, based off some old protype code from mjd. I
don't know exactly how mjd's current debugger compares to mine, but mine
does have the benefit of both a command-line and tk-based interface.

http://www.perl.com/rebug/

And coming soon...a regex compiler! Compile down regexes from their
perl-interpreted based environment to native C code under the hood. While
there is little benefit on simple regexes /abc/, there can be an order of
magnitude improvement as the regexes get more complex. For now, I've only
implemented character classes, anchors and the various quantifiers
working. But hopefully it shouldn't be too hard to implement the various
others. (I think lexically scoped variable access from within (?{}) will
be impossible, unless I have perl6's getcallernamespace). More info on
this to come soon.

I have yet to figure out if anyone uses complicated regexes enough that
something like this would be useful. But I still think it's fun,
regardless of practical benefits.

Fun? You decide. Please let me know privately if you think this is
horribly-unfun and that I should stay away from this stage.

You can now have the stage back.

Mike Lambert




RE: regex for html img... tags

2002-03-20 Thread Ala Qumsieh


Abigail writes:

 That Perl has the name of being inherently obfuscated, has, IMO, other
 reasons. It's the design of Perl; it allows you to do things 
 in many ways,
 with lots of special cases. That's a dual edged sword, it 
 makes life of
 the experienced programmer with self-discipline easier, but 
 it provides
 too much rope for most programmers.

Perl being a double-edged sword is, IMHO, a good thing. Perhaps, this is its
best characteristic. Giving people the option to do things in multiple ways
taps into their creativity, and soon they will be doing remarkable things
that were never thought possible.

Think of the internet. It definitely is a double-edged sword, but no one
goes around blaming the design of the internet for all the spam one receives
in their mail box, or for the ultra-abundance of porn sites. Yet, we can't
dispose of the internet because of all its positive features. The same
argument can be made regarding the human brain, which is capable of
producing beautiful art work, and musical compositions, and medical
breakthroughs, right along side the planning of wars, and ethnic cleansing,
and other horrors.

If Perl were to be limited to good syntax and one right way of doing
things, it would turn into another Python, and I would simply turn away to
Tcl or Ruby or some other language.

Just my two cents on why Perl is beautiful!

--Ala




Re: perl job saving (was Re: Non-golf fun)

2002-03-20 Thread Chris Benson

On Tue, Mar 19, 2002 at 11:16:40PM -0500, Uri Guttman wrote: 
 
 this current thread on fwp on perl saving someone's job is interesting 
 and i think more on the lines of advocacy and even discussing perl 
 jobs. so i cc'ed to those lists to get more of those 'perl saved my A**'
 stories. we have success stories on jobs.perl.org and others on 
 perl.com. and advocacy has some stories i think. but a collection of 
 these stories would be great to have.

HOW PERL SAVED MY A**

Background:

I used to be development/1st-/2nd-/3rd-line tech. support for a software
house selling back-office systems to lawyers.

Lawyers accounts remain open for the life of a case -- you can't
transfer balances at the end of a period like (some) normal accounts.
Therefore you have to transfer data from any existing system -- even if
it's a 20 year-old mini from a defunct manufacturer, with no support,
no documentation, no system software and no file/record layouts.

We would get the user to print all the reports on the system ... and
capture the output to disk.  I used grep+sed+awk to process these text
files into the form our application needed.

The story:

Close of business one Friday afternoon: I visited a firm of lawyers
and collected their live data.  I took the data home and started
the conversion on the machine that I would be installing -- with the
converted data -- on Monday morning.  (I had already collected test
data and written and tested the scripts with a sub-set of the data).
The conversion should take until Saturday night, then I would spend
Sunday verifying and cross-checking the results.

Saturday morning: come down to find the machine only 10% through the
processing and the disk chattering away.   I eventually managed to log
in and found that the awk conversion process was using all RAM + 50%
swap ... and growing at 4kB every few records ...

A quick calculation showed that (a) it would run out of swap before
completion and (b) it was not going to be finished in time for a Monday
morning installation.

ARGH!

I was committed to a Monday install.  One thing you learn working for
lawyers -- you do not upset lawyers: it tends to be expensive.

Aside:

I had been playing round with this new language that has been released
(in several dozen messages posted to comp.lang.misc (or something)):
Perl -- already at version 3.  I had managed to get it compiled on the
Altos Unix systems we were using then, but hadn't done much with it
-- the challenge had been getting it running on Altos Unix :-),  but I'd
noticed that (a) it was supposed to be at least 10x faster than awk and
(b) it had a awk-to-perl translator.  I happened to have a tape with
Perl compiled for Altos Unix with me.

Back to the plot:

* I cut several thousand lines of awk code out of the shell scripts they
were embedded in and saved them in separate files.

* I installed perl from the tape.

* I ran a2p on the files -- and saved the results.  I noticed a few
warnings telling me to check whether the correct character or numeric
test had been chosen: it had.

* a2p also pointed out a mis-placed comment  -- that turned out to
be causing the memory leak -- but didn't generate an error or warning
from awk.

Even though removing the comment had (apparently) solved to problem, 
I was running late, so having created the Perl scripts I decided to use
them:  the processing took under 1 hour.

** The processing took under 1 hour. **

The expected processing time in awk was ~18 hours:  In spite of the
problems with awk,  because of Perl I was now ahead of schedule.

The system was installed on the Monday morning.

This story still brings tears of relief/joy to my eyes.

I have used Perl ever since.  
-- 
Chris Benson



Re: AW: regex for html img... tags

2002-03-20 Thread Randal L. Schwartz

 Bernard == Bernard  [EMAIL PROTECTED] writes:

Bernard They don't see the beauty in it and some get downright angry
Bernard when they learn that to access an array element you have to
Bernard use $array[2] instead of @array[2], or to access a hash
Bernard element you'd use $hash{key} instead of %hash{key}.

And how angry will *we* be, when we've got to relearn that the way
they wanted it to work is the way it *does* work in Perl6!

:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] 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!