Re: Punctuation Free Quine -- Almost

2006-09-19 Thread Bart Lateur
On Tue, 19 Sep 2006 11:34:26 +0100, McGlinchy, Alistair wrote: I've managed to get it down to just a comma and a dollar. print readline open print, $0 There's the open FOO trick which means the same as open FOO, $FOO with FOO and $FOO global. So I can reduce this

Re: code line of the day

2006-09-13 Thread Bart Lateur
On Fri, 8 Sep 2006 08:19:21 -0700 (PDT), John Douglas Porter wrote: If you really want to test the ref type, do so robustly using the methods in Scalar::Util. I'm not convinced that is indeed the best approach. So Uri expects either a plain string, or a scalar ref to a string. What if instead

Re: code line of the day

2006-09-07 Thread Bart Lateur
On Thu, 07 Sep 2006 03:29:02 -0400, Uri Guttman wrote: this line of my code grew to its present form which i find amusing. @{$self-{templates}}{ keys %{$tmpls} } = map ref $_ eq 'SCALAR' ? \${$_} : \$_, values %{$tmpls} ; discuss amongst yourselves. topics include: what

Re: Naming the @{[]} operator

2006-07-13 Thread Bart Lateur
On Thu, 13 Jul 2006 04:29:38 -0400, Chasecreek Systemhouse wrote: On 7/7/06, Jerrad Pierce [EMAIL PROTECTED] wrote: perl -le 'print @{[time]}' What the advantage the above over this: perl -le 'print time' Oh come on, you asked how to use @{[]}. Well, its main purpose is a way to embed

Re: Interesting little regex

2006-02-23 Thread Bart Lateur
On Thu, 23 Feb 2006 13:02:32 -0500, Uri Guttman wrote: AY $text =~ s{( AY (\b\w+(?:['-]+\w+)*\b) why the multiple ['-] inside the words? could those chars ever begin or end words? so just [\w'-]+ should be fine there. That reminds me, only earlier today I looked at the word

Re: Secret operators

2005-02-02 Thread Bart Lateur
On Tue, 1 Feb 2005 11:49:57 +, José Castro wrote:can anyone tell me about other secret operators? I just produced this in my own code, I think it would qualify. Take this expression in list context: cond ? foo : () I'm talking about the 3 characters at the end: : (). I'd call it a

Re: s/// w/o intermediate variables?

2004-05-05 Thread Bart Lateur
On Wed, 5 May 2004 02:04:54 +0100, Allen, Greg wrote: But if we were golfing... Well I suppose it's still pretty ugly. I do find the ($transformed = $package) =~ s,::,/,g; construction pretty unreadable though. People expect flow of control to be left to right, while data flow in assignments is

AW: TRUE

2004-01-22 Thread Bart Lateur
On Thu, 22 Jan 2004 07:16:11 -, Pense, Joachim wrote: So I'd rather write $VERBOSE and $STOP_ON_ERROR, living with the minor risk that I might inadvertently change the values. You can reduce the risk by making them pseudo-constants (globals only): *VERBOSE = \1; print

Re: range operator for a condition in 2 steps

2003-07-31 Thread Bart Lateur
On Wed, 30 Jul 2003 21:36:46 -0500, James E. Tilley wrote: Does if (/^BEGIN$/ .. (/^\s*$/ .. /^END$/) =~ /E/) do what you want? s/BEGIN/START/ to plug it in the skeleton. And yes, that's perfect. Quite elegant too. Very much so. Here's my own solution: my $pre;

range operator for a condition in 2 steps

2003-07-30 Thread Bart Lateur
What I would want is to match lines in a loop, one line at a time, say, between a line cotnaining just START and a line containing just END, but where the latter condition is only looked at, after an intermediate condition has been met first. In particular, I have to have seen a blank line first.

Matching Roman numerals

2002-10-26 Thread Bart Lateur
Can someone come up with a (nice) regex that matches only Roman numerals? I'm trying to include proper case conversion to title case in a script, and it should turn a movie title like HALLOWEEN II into Halloween II, not Halloween Ii. -- Bart.

Re: correctly rebuilding a whitespace-split string

2002-10-15 Thread Bart Lateur
On Tue, 15 Oct 2002 18:08:57 +0200, Bart Lateur wrote: You mean with the same amount of whitespace as before? None of the solutions I've seen does that. Oops. Some do. -- Bart.

Re: correctly rebuilding a whitespace-split string

2002-10-15 Thread Bart Lateur
On Tue, 15 Oct 2002 17:14:39 +0100, Jasper McCrea wrote: Why not just: s/(\s+\S+){4}\s*$//; $1 for the chopped stuff. $1 contains the last word and preceding whitespace. For every match, the captured value overwrites the previous one. You need parens around it all to capture the lot.

Re: ~9M lines of data

2002-10-14 Thread Bart Lateur
On Mon, 14 Oct 2002 17:34:19 +0100, Simon Cozens wrote: This is what the flip-flop operator is for. Which bring s up a good question. The OP talked about 50 or so lines. Shall we take this literally? I know the flip-flow operator returns the number of times it was succesful in a row, already,

Re: ~9M lines of data

2002-10-14 Thread Bart Lateur
On Mon, 14 Oct 2002 16:35:21 -0400, Bernie Cosell wrote: I think they're referring to the '..' operator in scalar context: In scalar context, .. returns a boolean value. The operator is bistable, like a flip-flop, and emulates the line-range (comma) operator of sed, awk, and

Re: Content-type:image/gif\n\n problem

2002-09-30 Thread Bart Lateur
On Mon, 30 Sep 2002 16:27:58 +0100, [EMAIL PROTECTED] wrote: Would it include binmode() ? Most definitely. -- Bart.

diff between hyphenated and non-hyphenated version of a word

2002-09-05 Thread Bart Lateur
When thinking of a user-friendly interface to let a user define a table of words and their hyphenated forms, I stumbled across this cute problem. It's simple enough to be a fun puzzle, yet not too hard to be labour. It might even be a fun task for Perl Golf. The problem is this: given two

Re: diff between hyphenated and non-hyphenated version of a word

2002-09-05 Thread Bart Lateur
On Thu, 05 Sep 2002 15:04:30 +0200, Bart Lateur wrote: The problem is this: given two versions of a word, one without, and one with hyphenation, determine which hyphens are soft hyphens (optional breakpoints), and which ones are hard hyphens? For example: hypo-allergeen hy-po-al-ler

Re: My first JAPH

2002-07-12 Thread Bart Lateur
On Thu, 11 Jul 2002 11:40:47 +0100, [EMAIL PROTECTED] wrote: $_=reverse qw' r e k c a h x l r e P x r e h t o n a x t s u J ' t n i r p;y y xyzz y;eval; Question: does anybody know how to include the comma, without any warnings under -w? -- Bart.

Re: Maybe-useful subroutine

2002-07-01 Thread Bart Lateur
On Mon, 01 Jul 2002 14:57:36 +, sara starre wrote: Unfortunately I can't get your solution to work: DB1 main::r2(./x.pl:66): $_ [0] %= {$_ [1]}; DB1 Modification of a read-only value attempted at ./x.pl line 66. Seems it doesn't like you trying to modify $_ [0] ? Then make a

Re: perl5.6.1 oddity?

2002-06-14 Thread Bart Lateur
On Fri, 14 Jun 2002 00:21:16 -0400, Michael G Schwern wrote: The history is someone noticed that since this: my $foo; $foo = $foo . 42 Use of uninitialized value at -e line 1. and this: my $foo; $foo .= 42 are logically the same, the former shouldn't warn. Perhaps... (I

Re: perl5.6.1 oddity?

2002-06-14 Thread Bart Lateur
On Fri, 14 Jun 2002 11:27:33 -0400 (EDT), Jeff 'japhy' Pinyan wrote: On Fri, 14 Jun 2002 00:21:16 -0400, Michael G Schwern wrote: The history is someone noticed that since this: my $foo; $foo = $foo . 42 Use of uninitialized value at -e line 1. and this: my $foo; $foo .=

Re: perl5.6.1 oddity?

2002-06-14 Thread Bart Lateur
On Fri, 14 Jun 2002 16:33:57 -0500, Chris Dolan wrote: Sorry for the newbie-ish question, but can someone explain why op= does not warn? Is it because (quoting perlop) $a += 2; is equivalent to $a = $a + 2; although without duplicating any side effects that dereferencing the lvalue

Re: shortest test for truth false assignment

2002-05-26 Thread Bart Lateur
On Wed, 22 May 2002 13:04:53 -0600, Scott Wiersdorf wrote: What is the shortest way to test a variable for truth and then set its value to false such that the truth test still succeeds? For example, I have a global variable $a (given) that is somehow set to true. I want to test it for truth and

Re: A better way ?

2002-04-17 Thread Bart Lateur
On Wed, 17 Apr 2002 15:01:50 -0400, Michael G Schwern wrote: On Wed, Apr 17, 2002 at 02:34:20PM -0400, Bill -Sx- Jones wrote: Actually, the input data looks more like [SNEEX] [ADMIN] [END] # setup %Dispatch as before, then... while( $vData =~ /\[([A-Z])\]/g ) {

Re: Fisher-Yates shuffle

2002-04-12 Thread Bart Lateur
On Fri, 12 Apr 2002 12:00:54 +0100 (BST), Jonathan E. Paton wrote: Many perl features are core, that don't need to be... e.g. networking/unix permissions stuff. Removing these makes a far cleaner language. Amen to that. For example, I find it pretty amazing that fcntl() is part of the

Re: Self extracting Perl ARchive?

2002-04-01 Thread Bart Lateur
On Mon, 1 Apr 2002 15:16:47 +0100 (BST), Jonathan E. Paton wrote: and the only compression module I could find: http://search.cpan.org/search?module=Compress::LZV1 Heh? What about Compress::Zlib, which is based on the zlib library, and is used both by Archive::Tar and Archive::Zip? It doesn't

Re: Eugene writes a book on Perl Golf

2002-03-25 Thread Bart Lateur
On Mon, 25 Mar 2002 12:36:50 +1100, [EMAIL PROTECTED] wrote: Searching amazon on Perl Golf reveals that Eugene has already written a book on Perl Golf under the pseudonym of Eugenia Perl: Understanding Golf Games, a guide for all skill levels by Eugenia Perl

Re: PGAS Web Service

2002-03-15 Thread Bart Lateur
On Fri, 15 Mar 2002 13:09:04 +1100, [EMAIL PROTECTED] wrote: En op 14 maart 2002 sprak Bart Lateur: Don't say you've never heard of cookies. cookie. US, a small sweet biscuit. biscuit. Brit, a small unleavened cake. I apologize for my ignorance, but when I installed Windows, I asked

Re: PGAS Web Service

2002-03-14 Thread Bart Lateur
On Thu, 14 Mar 2002 11:23:47 +1100, [EMAIL PROTECTED] wrote: I like that use.perl.org. You log in with your username and password. But it seems to remember where you did that from because I have gone for days without going to the bother of re logging in, yet every time I go to that site it

Re: longest common substring (return of)

2002-03-13 Thread Bart Lateur
On Thu, 14 Mar 2002 10:38:29 -0500, Ted Zlatanov wrote: Has anyone developed an implementation of the well-known bitstring algorithm? Basically you convert your data strings to bitstrings, AND the two, and look for the longest match. Maybe it's just me, but that doesn't feel right. If you AND

Re: rethinking printf

2002-03-06 Thread Bart Lateur
On Wed, 6 Mar 2002 17:57:07 -0500, Uri Guttman wrote: how often will you need to interpolate a hash? A whole hash: quite rarely. A hash item: a LOT. Don't forget that $foo{BAR} will now become %foo{BAR} -- Bart.

Re: Fwd: Re: interesting typo I couldn't see

2002-02-22 Thread Bart Lateur
On Sat, 16 Feb 2002 11:05:14 -0800, Vicki Brown wrote: It took me a while to find the problem... when I did I was somewhat amused if (...) { my @item_parts = split(/\n/, $item); printf ORDER (\n%4d %-50s %3.2f %3.2f\n,

Re: TPR0 Final Results

2002-02-16 Thread Bart Lateur
On Sat, 16 Feb 2002 11:10:17 +0100, F. Xavier Noria wrote: : What an anti-climax. Utterly boring. Maybe being a mathematician I am a bit formalist, but the challenge was to use as few strokes as possible, if you didn't use strtol you lost. If you didn't want to use strtol as an option you are

Re: TPR0 Final Results

2002-02-15 Thread Bart Lateur
On Fri, 15 Feb 2002 08:53:45 -0600, Dave Hoover wrote: Here is the winning solution: #!perl -l use POSIX;print~~strtol pop,36 Boo, boo! What an anti-climax. Utterly boring. -- Bart.

Re: Golf and the Perl Review

2002-02-08 Thread Bart Lateur
On Fri, 8 Feb 2002 18:35:06 +1100 , [EMAIL PROTECTED] wrote: Jerome Quelin wrote: I think the arbiter program could (should?) be a module, but not the client part. Agreed. We should make things as easy as possible for the customer. No modules to install. Just download and run the test

Re: Golf and the Perl Review

2002-02-08 Thread Bart Lateur
On Fri, 08 Feb 2002 14:00:48 +0100, Bart Lateur wrote: At least, this appears to be working: #! perl -l open STDERR, errors.txt; warn This goes to the file, date = .localtime print Result: . `perl otherscript.pl`; But only (as intended) with a semicolon right after

Re: Golf and the Perl Review

2002-02-08 Thread Bart Lateur
On Fri, 08 Feb 2002 09:06:03 -0500, Morbus Iff wrote: Not sure what you mean, here. I've been using this code in the crossplatform AmphetaDesk [1], and it's been working fine (collecting thousands of warnings from a Win32::GUI, IO:: kills, etc.): # open our log file, turn on autoflush,

Re: Golf and the Perl Review

2002-02-06 Thread Bart Lateur
On Wed, 6 Feb 2002 00:29:53 -0500, Uri Guttman wrote: the kabbalah is a collection of mystical and spiritual jewish teachings and writings over the last two thousand years. it doesn't have anything to do with the word cabal AFAIK. On Wed, 6 Feb 2002 01:02:27 -0500 (EST), Brett W. McCoy wrote:

Re: Golf and the Perl Review

2002-02-05 Thread Bart Lateur
On Wed, 6 Feb 2002 00:05:12 -0500, Bill -OSX- Jones wrote: What does cabal really mean, in a Perl perspective? I know the dictionary/definition: ca·bal n. 1. A conspiratorial group of plotters or intriguers: “Espionage is quite precisely it—a cabal of powerful men, working secretly”

Re: substitution question

2002-02-02 Thread Bart Lateur
On Sat, 2 Feb 2002 12:35:13 -0800 , Pradeep Sethi wrote: and I want to use regexp , without using sprinf. !?!?!! WTF is wrong with sprintf()? It's a proper tool for this job. Next you'll want to replace 13.57831 by 13.58 without using sprintf(). Which is doing things the hard way. Also want

Re: substitution question

2002-02-01 Thread Bart Lateur
On Thu, 31 Jan 2002 22:10:03 -0500, Michael G Schwern wrote: $date =~ s{(.*)}{sprintf '%02d/%02d/%d', split '/', $1}e; $date =~ s{(\d+)/(\d+)/(\d+)}{sprintf '%02d/%02d/%d', $1, $2, $3}e; -- Bart.

Re: Beginner's definition ?

2002-02-01 Thread Bart Lateur
On Fri, 1 Feb 2002 12:37:40 +0100, Jérôme Quelin wrote: I mean, what the heck could a beginner do to improve Eugene's solution? What the heck can *anybody* do to improve Eugene's solution? When paricipating in Perl golf, he's virtually always in the lead. -- Bart.

Re: A perverse use of the glob function

2002-01-30 Thread Bart Lateur
On Wed, 30 Jan 2002 14:17:01 +1100, [EMAIL PROTECTED] wrote: but then I remembered a post by Perl Monk tilly (something about a color chart) where he used glob in a most perverse way. I had never done this myself, however, so I started with a small program: @a = glob('|y|{a,e,i,o,u,y,}||c');

Re: STDERR

2002-01-28 Thread Bart Lateur
On Sun, 27 Jan 2002 12:34:55 -0500, Bill -OSX- Jones wrote: Isn't there another var that is the same as STDERR ? And can't you set $! directly, and when printed - goed to STDERR ??? I'll tell ya -- after the game closes. Which should be... in 14 hours? -- Bart.

Re: STDERR

2002-01-28 Thread Bart Lateur
On Mon, 28 Jan 2002 10:19:56 +0100, Bart Lateur wrote: On Sun, 27 Jan 2002 12:34:55 -0500, Bill -OSX- Jones wrote: Isn't there another var that is the same as STDERR ? And can't you set $! directly, and when printed - goed to STDERR ??? I'll tell ya -- after the game closes. Which should

Re: Regex puzzle

2002-01-20 Thread Bart Lateur
On Sat, 19 Jan 2002 23:26:16 -0500, Michel Lambert wrote: Here's something which generates a regex that matches most shrinkable strings. print join|,map{$_.*[^$_-z]}('a'..'z') which prints out: a.*[^a-z]|b.*[^b-z]|c.*[^c-z]|d.*[^d-z]|e.*[^e-z]|f.*[^f-z]|g.*[^g-z]|h.*[^h

Re: ^=~

2002-01-19 Thread Bart Lateur
On Sat, 19 Jan 2002 14:42:11 +, Robin Houston wrote: On London.pm we're wondering what this Perl 6 operator is called. Suggestions so far: topcat, firework, rat, squirrel. Any thoughts? Horseback. The top of the head and tail are there, too. -- Bart.

Re: graphing the sexchart

2002-01-03 Thread Bart Lateur
On Mon, 31 Dec 2001 16:15:39 -0800, Paul Makepeace wrote: I couldn't figure out a Perl-ish way of parsing it, resorting to putting it all in a big 2D array and scurrying around it. I still have no clue what it's all about (it's no fun being left all in the dark), but can't you use vec()? If

Re: test a password string for correctness

2001-12-20 Thread Bart Lateur
On Thu, 20 Dec 2001 19:00:30 +0100, Philip Newton wrote: On Thu, 13 Dec 2001 10:50:11 -0500, [EMAIL PROTECTED] (Ronald J Kimball) wrote: (y/a-zA-Z// 2) (y/0-9// 1) Each numeric comparison will return either 1 or 0. In my experience, 1 or , rather than 1 or 0. Or is FALSE (PL_NO?) a

Re: The Twelve Days to Christmas

2001-12-14 Thread Bart Lateur
On Thu, 13 Dec 2001 08:10:44 -0500, Yanick wrote: The following is not very clever obfuscation, and it's not the most palatable ASCII drawing ever drawn, but I suppose it's good enough to elicit a few chuckles and/or groans. On day 3, a bug becomes visible: the final line And a

Re: tri-state flags

2001-12-06 Thread Bart Lateur
On 5 Dec 2001 16:25:16 -, Lars Henrik Mathiesen wrote: [EMAIL PROTECTED] (Bernie Cosell) writes: On 5 Dec 2001, at 11:34, [EMAIL PROTECTED] wrote: But Bart said he wanted to test for 0. The test above, and several of the other proposals don't distinguish between 0 and the empty string.

Re: tri-state flags

2001-12-06 Thread Bart Lateur
On Thu, 6 Dec 2001 02:56:58 -0500, Uri Guttman wrote: so the main boolean test is ref! Thank goodness that ref() doesn't generate a warning when used with undef as a parameter. -- Bart.

Re: tri-state flags

2001-12-05 Thread Bart Lateur
On Wed, 5 Dec 2001 07:44:00 -0400, Bernie Cosell wrote: but from what he said, I'd think that bumming off of concluding It is not undef and not true implies it must have been zero is legit within the parameters of the challenge, no?? Yes. The values to test for are true, false (but not

Re: World's Largest JAPH

2001-09-11 Thread Bart Lateur
On Tue, 11 Sep 2001 08:56:54 +1000, [EMAIL PROTECTED] wrote: Just to clarify, the JAPH starts with the line: '%'=~ not with: open 0; Your leading junk looks suspiciously like the original ASCII program from which the JAPH was generated (with a leading #! perl -w added). If you delete

Re: Fun with xterm window titles, or Yet Another golf challenge

2001-09-08 Thread Bart Lateur
On Fri, 7 Sep 2001 10:52:04 +0200 , Newton, Philip wrote: export PROMPT_COMMAND=pwd|perl -pe 'chop;s#^.*(/.+/.+)\$#...\1#;\$_=qq(\e]0;\$_\a)' ^ (ouch) You should be able to get rid of '^.*' since you're not capturing that bit -- *every*

Re: Sorting in-place

2001-07-31 Thread Bart Lateur
On Wed, 1 Aug 2001 00:24:50 +0200, Abigail wrote: There's more than one block in do {{EXPR; last}}. Argh! Pretty obfuscated, that is. -- Bart.