Re: Rate my JAPH

2011-12-07 Thread Randal L. Schwartz
 Andrew == Andrew Savige ajsav...@yahoo.com.au writes:

Andrew  print Just another Perl hacker,

That's missing the trailing semicolon.  I was pretty consistent on
putting that there.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


Re: Rate my JAPH

2011-11-25 Thread Randal L. Schwartz
 Jeff == Jeff Yoak j...@yoak.com writes:

Jeff I intentionally grabbed an early one of Randal's for that stone
Jeff snippet, though it is old enough be may not even recognize it.  It
Jeff was crafted in 1990 and posted from an intel address.  :-)

I do in fact recognize it... it split a string into a hash, then printed
the hash elements by order.  I think that's also the one that fails
later, thanks to the randomization applied to hash key seeds now for
security purposes.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


Re: Rate my JAPH

2011-11-24 Thread Randal L. Schwartz
If there were points for earliest JAPH, I'd get an unfair advantage. :)
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


Re: code line of the day

2006-09-07 Thread Randal L. Schwartz
 Uri == Uri Guttman [EMAIL PROTECTED] writes:

Uri@{$self-{templates}}{ keys %{$tmpls} } =
Urimap ref $_ eq 'SCALAR' ? \${$_} : \$_, values %{$tmpls} ;

Uri discuss amongst yourselves. topics include: what does it do?

Uh, it throws a lot of warnings when values(%$tmpls) has non-references?

What do I win?

-- 
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!


Re: Secret operators

2005-02-03 Thread Randal L. Schwartz
 Eugene == Eugene van der Pijll [EMAIL PROTECTED] writes:

 @{[]}  aka ???The Schwartz   early 1990s

Eugene The Larry, May 1 1994
Eugene  http://groups-beta.google.com/group/comp.lang.perl/msg/1d82c7c3f3e94266

The array version was actually discussed in private email between me
and Larry, if I recall correctly, shortly before that public post,
because I had come up with it for some courseware of mine.

But, this *is* 10 years ago, and I could be mismembering.

-- 
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!


Re: unhead

2004-09-25 Thread Randal L. Schwartz
 Keith == Keith C Ivey [EMAIL PROTECTED] writes:

Keith   perl -pe '$_ x=!(1..5)'

FWP.  Not Golf. :)

-- 
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!


Re: Semcarlbd letrtes sepur! (Scrambled letters super!)

2003-09-19 Thread Randal L. Schwartz
 Ton == Ton Hospel [EMAIL PROTECTED] writes:

 This is very nice (I didn't know about \B either); how randomly does
 that scramble? I'm sure there's a thread somewhere on that.
 
Ton Not very. The sort{rand 2} trick has been rejected in golfs before.

I don't know about current perl versions, but in older perl versions,
that'd lose elements, double up on elements, or even coredump.

-- 
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!


Re: qw(l i s t) vs (l, i, s, t)

2003-07-22 Thread Randal L. Schwartz
 John == John Douglas Porter [EMAIL PROTECTED] writes:

John Randal L. Schwartz [EMAIL PROTECTED] wrote:
 ... the last element of a list in a scalar context.

John Randal said ...a list in a scalar context.  /me faints.

I said last element of a list in a scalar context.   Don't misparse.
There's still no such thing as a list in a scalar context.

You can't quote me out of context.
And you can't get that context out of me.

:-)

-- 
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!


Re: When the Schwartzian Transform gets out of control...

2003-02-11 Thread Randal L. Schwartz
 Bennett == Bennett Todd [EMAIL PROTECTED] writes:

Bennett When I got around to writing the thing, here's what came out. Sort
Bennett of an elaborated and extended Schwartzian Transform. The naughty
Bennett bits can be found quickly by searching for map and sort. I
Bennett think the maps with big tagging regexps are particulary juicy.

Bennett I'm undecided whether this is good.

If you need only the best (or worst) of the list, a sort is probably
overkill.  Just do a high-water mark scan, keeping the best
candidate as you compare it with each other candidate.

-- 
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!



Re: Metaprogramming

2002-12-14 Thread Randal L. Schwartz
 Bernie == Bernie Cosell [EMAIL PROTECTED] writes:

Bernie In fact, unless I'm misunderstanding how the closure works, $constant 
Bernie is exactly correct and '42' would be incorrect... 

No, that's wrong.  Read my other post.

-- 
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!



Re: Metaprogramming

2002-12-13 Thread Randal L. Schwartz
 Michael == Michael G Schwern [EMAIL PROTECTED] writes:

 Nope, I've given examples of subroutines that cannot currently be
 accurately deparsed.

Michael Because of the nature of Perl or because of a mistake in B::Deparse?

Not completely sure.  The problem is closures, because you end up
having to figure out how to construct the right sharing of lexicals
amongst the various coderefs you've discovered.

-- 
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!



Re: Metaprogramming

2002-12-13 Thread Randal L. Schwartz
 Steffen == Steffen Mueller [EMAIL PROTECTED] writes:

Steffen Okay, I admit to have relied on an overgeneralized interpretation of
Steffen Randal's post about closures being a problem for B::Deparse.

Steffen I *do*, however, remember B::Deparse failing to deparse some entries
Steffen to the tpr04b golf contest which posed some trouble to my judging the
Steffen entries. Those pieces of code qualify as pathological, I suppose. :)

Let's see if this is the one:

sub black_adder {
  my $constant = shift;
  sub { $constant + shift; }
}

my $to_deparse = black_adder(42);
use B::Deparse;
print \n, B::Deparse-new-coderef2text($to_deparse), \n;

==

{
$constant + shift(@_);
}

Ayup.  That's the one.  *What* constant? :)  And that was the
first odd one I tried.  I could probably construct weirder ones
once that one is fixed.

So, coderefs that have been closed, break.

-- 
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!



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!



Re: regex for html img... tags

2002-03-19 Thread Randal L. Schwartz

 Andrew == Andrew Savige [EMAIL PROTECTED] writes:

Andrew : [...] Obfuscated Perl and Golf are both uninteresting to me.

Andrew And JAPHs. ;-)
Andrew Randal, I am curious, after all these years, are you still
Andrew interested in JAPHs?

Only vaguely.  I'm a bit embarassed by them, actually.  I think my
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
Obfuperl would have been come about some other way, but I'm sure my
JAPHs were a contributing factor.

Having said that, I really enjoyed Abigail's presentation a few years
back at YAPC.

-- 
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!



Re: regex for html img... tags

2002-03-17 Thread Randal L. Schwartz

 Kim == Kim Schulz [EMAIL PROTECTED] writes:

Kim hi
Kim I have a long string which contains some img.. html tags ala
Kim img height=67 alt= hspace=0
Kim src=C:\DHTMSamp\SAMPLES\Web\images\AddItem.GIF width=72
Kim align=baseline border=0
Kim I need to do it throughout the whole string which can contain serval
Kim img tags. I need an regex that can replace everything between src= and
Kim the imagename with images/ I want to make those stupid MS typical
Kim direct image links so they use the images on the server insted of
Kim those on the client machine. Can anyone help me?? thanx

This doesn't exactly qualify as on-charter for Fun With Perl.
You might try asking on the beginner's mailing list, or on the
Perl newsgroups.

-- 
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!



Re: regex for html img... tags

2002-03-17 Thread Randal L. Schwartz

 Jeremy == Jeremy Zawodny [EMAIL PROTECTED] writes:

Jeremy If that's true, perhaps this list should be renamed perl-golf so that
Jeremy those uninterested in golf can un-subscribe and be assured that they
Jeremy aren't missing anything...

I've actually been pondering the same thing.  FWP was originally far
more than Golf.  I've seen only Golf recently.  For that, I may pay
less attention.  Obfuscated Perl and Golf are both uninteresting to
me.

-- 
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!



Re: rethinking printf

2002-03-06 Thread Randal L. Schwartz

 Rich == Rich Morin [EMAIL PROTECTED] writes:

Rich This seems pretty ugly to me (Randal didn't like it much either :-)

Yup.

-- 
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!



Re: Study group for motivated people wanting to learn Perl.

2002-02-05 Thread Randal L. Schwartz

 Pradeep == Pradeep Sethi [EMAIL PROTECTED] writes:

Pradeep I am confused, I thought if in first case we declar var as hash, then we do
Pradeep my %var;

Pradeep and then later :

Pradeep   /(.*?)\s*=\s*(.*)/ and $$var{$1} = $2 while FILE;

No, that's if $var is a scalar.  If you have %var, you want $var{$1}.
-- 
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!



Re: substitution question

2002-02-02 Thread Randal L. Schwartz

 Anthony == Anthony J Breeds-Taurima [EMAIL PROTECTED] writes:

Anthony On Thu, 31 Jan 2002, Michael G Schwern wrote:
 Folks, I'm clawing my eyes out here.  Stop hitting the regex crack pipe!

Anthony the poster asked for a regex solution.

Where?

-- 
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!



Re: Relationship between Perl and various animals and sitcoms

2001-11-27 Thread Randal L. Schwartz

 Craig == Craig S Cottingham [EMAIL PROTECTED] writes:

Craig On Monday, November 26, 2001, at 04:20 , [EMAIL PROTECTED] wrote:
 Why Buffy? (as opposed to some other TV sitcom)

Craig Sitcom? That's the first time I've ever seen Buffy lumped in with
Craig the likes of Three's Company

Ah yes, the sitcom of Three's Company.  Big Sit, little Com.

:-)

-- 
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!



Re: Who is this Perl hacker?

2001-11-19 Thread Randal L. Schwartz

 Ala == Ala Qumsieh [EMAIL PROTECTED] writes:

Ala In my case, it's the hair that gave me the clue. But, I've never
Ala seen you in person and pictures can be deceiving :)

Ahh.  OK, I suppose my unkempt bangs are distinct enough.  But has the
original inquisitor already declared this a victory?

-- 
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!



Re: Photos/Caricatures of Larry Wall and other Perl luminaries

2001-11-05 Thread Randal L. Schwartz

 Simon == Simon Cozens [EMAIL PROTECTED] writes:

Simon aalib is pretty good. Stand well back. :)

I tried going into the other room.  That wasn't far enough.  :-)

-- 
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!



Re: World's First JAPH

2001-08-22 Thread Randal L. Schwartz

 Abigail == Abigail  [EMAIL PROTECTED] writes:

Abigail Being the one who has given several talks about Japhs, I've decreed
Abigail that a Japh uses the following rules:

Abigail- It prints Just another Perl Hacker with some reasonable
Abigail  captalization, followed by optional punctuation (comma,
Abigail  dot) followed by an optional newline. Some flexibility
Abigail  in rules makes for more Japhs. Printing to either STDOUT
Abigail  or STDERR is allowed.
Abigail- It doesn't print anything else.
Abigail- The program uses at most 4 lines, each line at most 80 characters.
Abigail- It uses obscure or surprising syntax.

Fine rules for JAPH version 1.0.  I lay claim to JAPH version 0.0, though. :)

-- 
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!



Re: JAPHs with no unsightly letters or numbers

2001-08-18 Thread Randal L. Schwartz

 John == John W Krahn [EMAIL PROTECTED] writes:

 Next, O'Reilly will be soliciting for JAPHs in a Nutshell!

John What animal do you want on the cover?   :-)

A Party Animal, of course. :)

-- 
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!



Re: Sorting in-place

2001-07-25 Thread Randal L. Schwartz

 Clinton == Clinton A Pierce [EMAIL PROTECTED] writes:

Clinton@dummy=sort {
Clinton$r=$a cmp $b;
Clintonif ($r  0) {
Clinton($a,$b)=($b,$a);
Clinton$r=1;
Clinton}
Clinton$r;
Clinton} @list;
Clinton# Is @list sorted?  Not quite...

Clinton Except this doesn't work.  Oh, $a and $b get modified and they're swapped
Clinton at appropriate times, but the resulting mess in @list can hardly be called
Clinton proper ordering.

For this to work, the element indirected by $a would have to always be
to the left of the element indirected by $b, and that's probably not
true.  In fact, we can see this:

@dummy = sort {
  print $a $b\n;
  $a = $b;
} 1..9;

4 5
5 6
3 5
2 5
1 5
5 7
5 8
5 9
7 6
8 7
9 8
2 1
3 2
4 3

See the last few?  If you were to swap the 4/3 pair to put them
in order, you're actually taking them *out* of order.

-- 
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!