Re: Japhs by SMS.

2001-08-09 Thread Ronald J Kimball
On Thu, Aug 09, 2001 at 04:17:36PM -0500, David L. Nicol wrote: Jeff 'japhy/Marillion' Pinyan wrote: Why not: 0=~(?\173\LPRINT\E'J\LUST ANOTHER\E P\LERL\E H\LACKER\12'\175); 65 chars. Wow. Why does binding this string to 0 cause it to get evald? It's a regular expression

Re: evaluating assigning to a list in if( ) statement

2001-09-03 Thread Ronald J Kimball
On Mon, Sep 03, 2001 at 09:35:13PM -0400, Lev Selector wrote: # Folks, just a note. # I thought that the #if (EXPR) # is supposed to evaluate the EXPR in scalar context, right? # Well, it does so in most cases # Except when you do an assignment to a list, when # instead of

Re: World's Largest JAPH

2001-09-12 Thread Ronald J Kimball
On Thu, Sep 13, 2001 at 12:12:09PM +1000, [EMAIL PROTECTED] wrote: The step 2 program uses a conversion module called Filth. I have no CPAN experience, and am open to suggestion, but this module might eventually become CPAN Convert::Filth (??). I'd suggest Acme::Filth, to go with Acme::Bleach

Re: Practical Perl Golf

2001-11-15 Thread Ronald J Kimball
On Thu, Nov 15, 2001 at 07:42:41AM -0500, Keith C. Ivey wrote: Jeff 'japhy' Pinyan [EMAIL PROTECTED] wrote: perl -pe's/^\s*#(?!\s*((ifn?|un)def|(el|end)?if|define|include|else)\ b).*//s' Note that without the /s modifier, . will NOT match the trailing \n, so I'd have to add \n to

Re: Daily Perl FAQ - How do I select a random line from a file? (fwd)

2001-11-29 Thread Ronald J Kimball
On Thu, Nov 29, 2001 at 06:36:06AM +0100, Philip Newton wrote: On Wed, 28 Nov 2001 12:46:06 -0600, [EMAIL PROTECTED] (Andy Bach) wrote: Thanks much. I thought there might be related technique for getting a rand element from an array, but we know the array length so ... this (from

Re: middle line (was Re: Daily Perl FAQ...)

2001-11-29 Thread Ronald J Kimball
On Thu, Nov 29, 2001 at 11:34:24AM -0800, Chris Thorpe wrote: On Thu, 29 Nov 2001, Yanick wrote: On Thu, Nov 29, 2001 at 01:34:02PM -0500, Michael G Schwern wrote: Yesterday, I saw an interesting related exercise. Write a program that reads the lines from a file and outputs the

Re: The Santa Claus Golf Apocalypse

2001-12-03 Thread Ronald J Kimball
On Mon, Dec 03, 2001 at 08:49:33PM +, Piers Cawley wrote: Ronald J Kimball [EMAIL PROTECTED] writes: Why would printing to STDERR warrant a penalty anyway? It should disqualify the entry entirely. On what grounds? Nothing was mentioned when the challenge was set except that we

Re: Possible improvements for the next golf apocalypse

2001-12-10 Thread Ronald J Kimball
On Sun, Dec 09, 2001 at 12:31:06PM +1100, [EMAIL PROTECTED] wrote: However, I suggest that in future games the Arbiter should reveal the leading scores for each hole about 4-8 hours from the end. This should make the final hours quite exciting. I think that 4-8 hours is too short,

Re: Possible improvements for the next golf apocalypse

2001-12-10 Thread Ronald J Kimball
On Mon, Dec 10, 2001 at 04:36:26PM +0100, BooK wrote: En réponse à [EMAIL PROTECTED]: IMHO a solution to a good hole should be in the 50-70 char region. That way there's more scope for styling the response. Such styling could include: - the least number of /a-z/i chars. - the

Re: test a password string for correctness

2001-12-13 Thread Ronald J Kimball
On Thu, Dec 13, 2001 at 03:24:14PM +0100, Sven Neuhaus wrote: On Thu, Dec 13, 2001 at 03:01:43PM +, Mohit Agarwal wrote: On Thu, Dec 13, 2001 at 02:49:05PM +0100, Sven Neuhaus wrote: y/A-Za-z/A-Za-z/2y/0-9/0-9/1 or the shorter $a=$_;y/A-Za-z//2y/0-9//1 that will

Re: test a password string for correctness

2001-12-13 Thread Ronald J Kimball
On Thu, Dec 13, 2001 at 08:36:03AM -0600, [EMAIL PROTECTED] wrote: If you are prepared to change $_: if (y/a-zA-Z//2y/0-9//1) {# 24 chars for the test print not valid; } That does not change $_. If you can't change $_, you need the c opt on the y's, hence: if

Re: test a password string for correctness

2001-12-13 Thread Ronald J Kimball
On Thu, Dec 13, 2001 at 10:41:57AM -0500, Jeff 'japhy' Pinyan wrote: I probably would have thought about y/// after a while, but I can't pass up a good regex. ;) y/a-zA-Z//2y/0-9//1 is probably where I'd get to. I think RJK's attempt to cheat the system fails: y/a-zA-Z//y/0-9//1

Re: test a password string for correctness

2001-12-13 Thread Ronald J Kimball
On Thu, Dec 13, 2001 at 07:11:09PM -0500, Ryan Fischer wrote: I guess it simply wasn't good that the guy asked a question on an FWP list where TMTOWTDI and so many people think the short ways are better. If he was simply looking for an answer, any other list would have worked fine. I guess

Re: Perl and majordomo

2001-12-26 Thread Ronald J Kimball
On Wed, Dec 26, 2001 at 04:46:11PM -0500, Michael G Schwern wrote: On Wed, Dec 26, 2001 at 01:24:20PM -0800, Sir Not-appearing-in-this-film wrote: Someone should write a working 'unsubscribe' function in Perl for Majordomo mailing lists. The current system does not seem to work.

Re: Interactive golf hole

2002-01-08 Thread Ronald J Kimball
On Tue, Jan 08, 2002 at 02:50:16PM -0500, Jeff 'japhy' Pinyan wrote: On Jan 8, Yitzchak Scott-Thoennes said: A file has 0 or more fields on each line. Fields are separated by 1 or more whitespace characters. Leading and trailing whitespace should be ignored. Comments (starting with # and

Re: Interactive golf hole

2002-01-08 Thread Ronald J Kimball
On Tue, Jan 08, 2002 at 11:50:44AM -0800, Yitzchak Scott-Thoennes wrote: Also, I said: Fields are separated by 1 or more whitespace characters, so xx is one 4 character field, not two 1 character fields. Woops, I got that part wrong. Gotta go rework my solution... Ronald

Re: Interactive golf hole

2002-01-08 Thread Ronald J Kimball
On Tue, Jan 08, 2002 at 01:30:12PM -0800, Yitzchak Scott-Thoennes wrote: On Tue, Jan 08, 2002 at 11:50:44AM -0800, Yitzchak Scott-Thoennes wrote: -n $,=':';$\=$/;print grep$_,/\G\s*(?:([^]*)(?:\s|$)|([^\s#]+))/g; (but what a poor score it gives... :/ ) It gets worse: While

Re: Golf challenge: decode CETI message

2002-01-12 Thread Ronald J Kimball
On Sun, Jan 13, 2002 at 03:41:40AM +0200, Ilmari Karonen wrote: On Fri, 11 Jan 2002, Philip Newton wrote: On Wed, 9 Jan 2002 20:34:30 -0500, [EMAIL PROTECTED] (Keith C. Ivey) wrote: But s'\x0\xff' @' to make it shorter and more visible on my system. y(s))y) ? qBut y'\x0\xff'

Re: Practical Perl Problem

2002-01-14 Thread Ronald J Kimball
On Mon, Jan 14, 2002 at 11:01:57PM -0500, Aaron D. Marasco wrote: At 22:54 14 01 2002, Ronald J Kimball wrote: On Mon, Jan 14, 2002 at 07:32:15PM -0500, Aaron D. Marasco wrote: The double hyphen in front of the incoming text is optional and could have spaces on either side

Re: Practical Perl Problem

2002-01-14 Thread Ronald J Kimball
On Mon, Jan 14, 2002 at 10:54:28PM -0500, Ronald J Kimball wrote: #!perl -nl s/^ ?-- ?//;push@a,[s/:$//?--== $_ ==--:/^ *(\S+)\s+(\S+)\s*(\S*)/]; $;=$:if($:=length$1)$;}{*b=$_,$#b?($b[2]=~s/.+/_vector($ downto 0)/, $b[2]=~s/^/ std_logic/,printf%-$;s : %s%s;\n,@b):print@b for@a __END__ P.S

Re: make a 24(another practical problem)

2002-01-18 Thread Ronald J Kimball
On Fri, Jan 18, 2002 at 10:27:14AM -0600, Greg Bacon wrote: In message [EMAIL PROTECTED] one.net, user who writes: Enumerating the possible operator layouts: - # # o # o # o - # # o # # o o - # # # o o # o - # # # # o o o where '#' represents a number and 'o' an

Re: match URI and nothing more?

2002-01-22 Thread Ronald J Kimball
On Tue, Jan 22, 2002 at 08:59:51AM -0800, Big D wrote: Bill, This is commonly referred to as 'leaning toothpick syndrome' (LTS). The problem is that you're using / as your regex delimiter AND you're not escaping it in your regex. Change your delimiter to something NOT in your regex, like @

Re: A present ...

2002-01-24 Thread Ronald J Kimball
On Thu, Jan 24, 2002 at 12:31:51PM -0500, Bill -OSX- Jones wrote: 69 strokes - #!perl -n next if(($.%2)||(((length)-1)%2));!((tr/aeiouy//)%2) and print$_; #!perl -n next if(($.%2)||(((length)-1)%2));print$_ unless((tr/aeiouy//)%2); But ... Still prints even sets of vowels :( -Sx-

Re: More Wacky Solutions

2002-01-31 Thread Ronald J Kimball
On Thu, Jan 31, 2002 at 05:28:15PM +0100, [EMAIL PROTECTED] wrote: One can get as close to 0.833 as one wants, by writing something like: $=ss; and adding as many 's's after the = as needed to obtain the desired ratio. $ is readonly; how about $ss; Ronald

Re: Finding Holidays

2002-02-06 Thread Ronald J Kimball
On Thu, Feb 07, 2002 at 12:19:01AM -0500, Bill -OSX- Jones wrote: Hi :) I was asked recently if I could write a Perl program that would find out when the next time Christmas day would actually be on a Sunday. #!perl use Date::Christmas qw/ christmasday /; for my $year (1900 .. 2100) {

Re: Longest Common Substring

2002-02-15 Thread Ronald J Kimball
On Fri, Feb 15, 2002 at 07:27:03AM -0600, Tim Ayers wrote: A == Andrew Pimlott [EMAIL PROTECTED] writes: A On Fri, Feb 15, 2002 at 01:37:15AM -0500, Jeff 'japhy' Pinyan wrote: Except that you are forced to find a 2-character match, which means you end up skipping a POTENTIAL

Re: TPR0 Final Results

2002-02-15 Thread Ronald J Kimball
On Sat, Feb 16, 2002 at 11:10:41AM +1100, [EMAIL PROTECTED] wrote: Stephen Turner wrote: Can someone explain to me why -l use POSIX;print strtol pop,36 doesn't work? Where does the extra 0 come from? To quote myself to Dave and Jerome: BTW, because I felt you were already

Re: interesting typo I couldn't see

2002-02-17 Thread Ronald J Kimball
On Sun, Feb 17, 2002 at 12:02:49PM -0500, Bill -OSX- Jones wrote: Vicki writes: if (...) { my @item_parts = split(/\n/, $item); printf ORDER (\n%4d %-50s %3.2f %3.2f\n, $quantity, $item_parts[0], $price,

Re: TPR1 post-mortem

2002-03-08 Thread Ronald J Kimball
On Fri, Mar 08, 2002 at 10:33:26AM +, Piers Cawley wrote: Stephen Turner [EMAIL PROTECTED] writes: On Fri, 8 Mar 2002 [EMAIL PROTECTED] wrote: Here are some statistics from the current series of games: fwp Santa (head, tail, ...):35 players on scoreboard irc Christmas

Re: TPR1 post-mortem

2002-03-08 Thread Ronald J Kimball
On Fri, Mar 08, 2002 at 12:04:15PM +0100, F.Xavier Noria wrote: On Fri, 08 Mar 2002 11:41:31 +0100 cizaire_liste [EMAIL PROTECTED] wrote: : Can someone explains me why : : my $c = '($a=www)=~s{}{z}g;print $a\n;die'; : eval $c; : $^O=~s{.}{$c}ee; : : output two lines that are

Re: TPR1 post-mortem

2002-03-08 Thread Ronald J Kimball
On Fri, Mar 08, 2002 at 03:16:10PM +0100, Marcelo E. Magallon wrote: A question of my own: why doesn't s/\B.\B/$$/g work as I expect, namely abcd - abbccd. I really can't figure it out by reading the docs. It works as expected in perl5.005_3 and perl5.7.2. There are many subtle

Re: Perl Golf as a sport

2002-03-10 Thread Ronald J Kimball
On Mon, Mar 11, 2002 at 12:31:25PM +1100, [EMAIL PROTECTED] wrote: I know, from bitter experience with Acme::EyeDrops, just how flaky the (?{}) construct is; normally you cannot use regular expressions inside it at all because Perl's regex engine is not reentrant. And yet, mysteriously, the

Re: Golf contests and naive solutions?

2002-03-17 Thread Ronald J Kimball
On Sun, Mar 17, 2002 at 10:00:47AM +0100, Jerome Quelin wrote: Hi folks, We were wondering if the referees were to provide a naive solution for perlgolf contests? This way, beginners could really see what the script is to do (remember Ton's Christmas tournament where only one beginner

Re: Why bother with separate lists?

2002-03-19 Thread Ronald J Kimball
On Tue, Mar 19, 2002 at 10:27:47PM -0500, Bernie Cosell wrote: Oh, please. If it took a minute to download *all* 143 messages I'd be surprised. Yes, I know that some folk do pay by the byte but minimizing- bytes has hardly been a hallmark of the postings to the list... [thinking here of

Re: Why bother with separate lists?

2002-03-25 Thread Ronald J Kimball
On Mon, Mar 25, 2002 at 11:19:37PM +0100, Philippe 'BooK' Bruhat wrote: On Mon, 25 Mar 2002 [EMAIL PROTECTED] wrote: But is this the official perl-golf mailing list? Or is Ronald or someone else going to create a new [EMAIL PROTECTED] and change the charter of [EMAIL PROTECTED]? Why

Re: First differing char in two strings

2002-04-11 Thread Ronald J Kimball
On Thu, Apr 11, 2002 at 05:06:28PM -0400, Prakash Kailasa wrote: On Thu, Apr 11, 2002 at 05:03:53PM -0400, Jeff 'japhy' Pinyan wrote: On Apr 11, Prakash Kailasa said: On Thu, Apr 11, 2002 at 08:06:14AM -0700, Paul Makepeace wrote: The task is to find the first differing character given

Re: First differing char in two strings

2002-04-25 Thread Ronald J Kimball
On Thu, Apr 25, 2002 at 12:51:33PM -0500, Craig S. Cottingham wrote: A: craigc@samantha craigc $ perl -e '$a = 1; print +(--$a + $a++) . \t$a\n' 1 1 B: craigc@samantha craigc $ perl -e '$a = 1; print +($a + $a++) . \t$a\n' 3 2 C: craigc@samantha craigc $ perl -e '$a =

Re: FW: shortest test for truth false assignment

2002-05-22 Thread Ronald J Kimball
On Wed, May 22, 2002 at 03:58:05PM -0400, Patrick Gaskill wrote: $a($a=0)||do{do_something()}; Anyway, the second bit of code there will short-circut after the first expression if $a is false, so everything after $a won't get executed, leaving $a alone. But has higher precedence

Re: shortest test for truth false assignment

2002-05-22 Thread Ronald J Kimball
On Wed, May 22, 2002 at 10:45:39PM +0100, Simon Cozens wrote: Scott Wiersdorf: if( $a%2 .. $a-- ) { I don't understand this. You see, if $a-- leaves $a as false, then: if ($a--) is the shortest way of solving the problem. But that will change $a to true if it was false. Here's

Re: shortest test for truth false assignment

2002-05-22 Thread Ronald J Kimball
On Wed, May 22, 2002 at 10:55:52PM +0100, Simon Cozens wrote: Ronald J Kimball: if( $a%2 .. $a-- ) { Here's what I understand the goal to be: If $a is true, set $a to false and execute some code But the code above doesn't do that for all true values. Sorry, I left out a condition

Re: shortest test for truth false assignment

2002-05-22 Thread Ronald J Kimball
On Wed, May 22, 2002 at 09:54:52PM -0400, Yanick wrote: On Wed, May 22, 2002 at 10:06:39PM -0400, Josh Goldberg wrote: I came up with another one. This also works for values of true other than 1. if ($a=~tr/.[^0]+/0/c) { do_something(); } s/tr/s/, maybe ? (the

Re: reading lines backwards

2002-06-11 Thread Ronald J Kimball
On Tue, Jun 11, 2002 at 12:18:42PM -0400, Selector, Lev Y wrote: Folks, Problem: need to read a very big text file starting from the end and moving backwards to its beginning. This is similar to a diamond ( FH ) operator functionality - but in the opposite direction. Need to do it

Re: a little shorter please?

2002-07-22 Thread Ronald J Kimball
On Mon, Jul 22, 2002 at 02:41:25PM -0400, Aaron J Mackey wrote: I can't seem to get this any shorter: I want the second through the next-to-last elements of F joined by , and then the last item of F. perl -ape '$,= ;s//F[1..$#F-1]\n$F[$#F]/' or (no join, but same general idea): perl

Re: Non-head, non-tail recursion???

2002-08-02 Thread Ronald J Kimball
On Fri, Aug 02, 2002 at 02:28:01PM -0500, [EMAIL PROTECTED] wrote: To understand recursion, we must first understand recursion. Thereby demonstrating tail recursion quite nicely, as distinct from GNU's Not Unix which demonstrates (presumably) head recursion. Can you think of an acronym or

Re: removing extra empty lines

2002-08-12 Thread Ronald J Kimball
On Mon, Aug 12, 2002 at 01:28:19PM -0400, Selector, Lev Y wrote: Folks, I have a long file which has many empty lines with nothing but may be spaces or tabs (/^\s*$/). These lines tend to group together creating chunks of empty vertical space on the printout. I want to reduce the

Re: Perl Challenges, Anywhere?

2002-08-30 Thread Ronald J Kimball
On Fri, Aug 30, 2002 at 11:58:03AM -0500, James Edward Gray II wrote: Could anyone point me in the direction of a Perl challenge/contest that's not Obfuscation or Golf? I've done some heavy searching but come up empty handed. Are you looking for an ongoing contest to participate in, or a

Re: Perl Challenges, Anywhere?

2002-08-30 Thread Ronald J Kimball
On Fri, Aug 30, 2002 at 12:31:19PM -0500, James Edward Gray II wrote: Forgive my ignorance, but what is the Perl Death Bowl or TCP 3, for that matter? TPC 3 was The Perl Conference 3.0. (This year's conference was TPC 6.0.) One of the events at TPC 3 was a sort of competitive programming

Re: NPL Puzzler for 6 Oct

2002-10-11 Thread Ronald J Kimball
On Fri, Oct 11, 2002 at 02:54:20PM -0400, Bernie Cosell wrote: The NPL puzzle for 6 oct was an interesting little Perl exercise [I'm not sure how to solve it analytically --- I played with it some to little avail --- but it was certainly subject to brute force, and it turned out to be a

Re: correctly rebuilding a whitespace-split string

2002-10-15 Thread Ronald J Kimball
On Tue, Oct 15, 2002 at 04:08:41AM +, Ton Hospel wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] writes: En op 15 oktober 2002 sprak Aaron Mackey: @d = splice(split, -4); # I always know that the last 4 fields This won't compile (first argument to splice must be an

Re: golf tee puzzle

2003-03-13 Thread Ronald J Kimball
On Thu, Mar 13, 2003 at 01:22:26PM -0800, Quantum Mechanic wrote: I came at it from another direction, starting out caching the board state (equivalent to @state) for each board seen. [In most cases, there are several paths to a given board state.] I also used some other speedups, like

Re: reencoding ampersands for html, longhand

2003-04-02 Thread Ronald J Kimball
On Wed, Apr 02, 2003 at 10:25:05PM -0600, [EMAIL PROTECTED] wrote: Anyway, I got all the named entities (the numbered ones aren't a problem), created a hash: %html_entities = ( quot = 1, amp = 1, lt = 1, gt = 1, nbsp = 1, ... [ 200 more entities ] and came up w/: sub clean_html {

Re: my if?

2003-07-01 Thread Ronald J Kimball
On Tue, Jul 01, 2003 at 05:15:09PM +0300, Vladi Belperchinov-Shabanski wrote: my $id = 1 if $_ == 3; my has a compile time behavior and a runtime behavior. At compile time, my allocates memory for the variable and adds it to the pad. At run time, my resets the value of the variable. If you

Re: I know this is not fun.

2003-07-17 Thread Ronald J Kimball
On Thu, Jul 17, 2003 at 09:31:31AM +0100, Moran, Matthew wrote: Gareth wrote: How about a perl filter to strip all non-fwp posts to this list? Depends on one's definition of fun I guess - some might say it's perl programs that are whimsical in some way like the Camel script, or a

Re: lvalue hash slice

2003-09-30 Thread Ronald J Kimball
On Tue, Sep 30, 2003 at 11:07:24PM +0300, Gaal Yahas wrote: I like hash slices: ($one, $two, $three) = @hash{ qw/aaa bbb ccc/ }; Sadly, this doesn't work as an lvalue: @hash{ qw/aaa bbb ccc/ } = ($one, $two, $three);# WRONG That actually does work. Ronald

Re: pattern finding problem

2004-03-09 Thread Ronald J Kimball
On Tue, Mar 09, 2004 at 01:43:05PM -0500, Ronald J Kimball wrote: I think I've got almost what you want. It correctly limits the length and number of repetitions (example 1) and handles overlapping occurrences of the pattern (example 2). The one flaw is that it will only match one

Re: lwall snippet

2004-04-10 Thread Ronald J Kimball
On Sun, Apr 11, 2004 at 12:06:17AM -0400, [EMAIL PROTECTED] wrote: I see. But I think you meant $_ x= /(..:..)...(.*)/ 'foo' ge $1 'foo' lt $2; since the shell's $2 is never used, as far as I can tell. I still have no clue what the shell's $1 would be in this case, other than

Re: fractional cents

2004-04-25 Thread Ronald J Kimball
On Mon, Apr 26, 2004 at 06:49:52AM +0200, Pense, Joachim wrote: A. Pagaltzis [mailto:[EMAIL PROTECTED] wrote: When you're dealing with money, it's better to use cents (or tenths or hundredths of cents) as a unit, rather than dollars. You can then use integer math. This gets you around all

Re: Another regexp conundrum

2004-06-01 Thread Ronald J Kimball
On Tue, Jun 01, 2004 at 02:11:56PM -0400, [EMAIL PROTECTED] wrote: 13 '__pqrxyz__pqr___abc___' =~ /(($re).*?)*(?!)/; Of course, this is incomplete, but it is a start. One thing that puzzles me is that the (?!) is absolutely required on line 13. Without it, @seen doesn't get

Re: Another regexp conundrum

2004-06-01 Thread Ronald J Kimball
On Tue, Jun 01, 2004 at 05:22:01PM -0400, [EMAIL PROTECTED] wrote: /(anything)*/ can always match a zero length substring at the beginning of the string, and as soon as the regex engine finds a match, it stops. The (?!) forces the regex engine to backtrack through all possible

Re: Load-Bearing Warnings

2004-08-03 Thread Ronald J Kimball
On Tue, Aug 03, 2004 at 06:12:25PM +, Smylers wrote: I turned warnings off in a script[*0] but made no other changes to it. This broke the script, in that it would no longer run correctly[*1]. In other circumstances[*2] I might've regarded this as fun. Presuming that this isn't a

Re: Shortening a script, but aiming for efficiency

2004-10-01 Thread Ronald J Kimball
On Fri, Oct 01, 2004 at 09:23:14AM -0600, Alan Young wrote: a\tb\t a\t\t \tb\t \t\t\t The output for all these should be: a|b a|\s |b |\s This means that I could start by replacing all tabs with pipes, but then I would always have to remove the last pipe... I

Re: A curious logic

2005-03-08 Thread Ronald J Kimball
On Tue, Mar 08, 2005 at 08:50:11AM -0500, Perl Diety wrote: ...are easy and IMO, not interesting... juxtapositioned with , but I never found one... Vern or Vernette, doesn't this imply that either: (a) You didn't look very hard, since being easy, they should also be

Re: Interesting little regex

2006-02-24 Thread Ronald J Kimball
On Fri, Feb 24, 2006 at 01:40:15PM -0700, Alan Young wrote: Yes, what are the unique occurrences of text in that string? I've run the code and I'm still not exactly sure what it's supposed to do. use Data::Dump qw/ dump /; $a=abcdex4;

Re: Interesting little regex

2006-02-24 Thread Ronald J Kimball
On Fri, Feb 24, 2006 at 03:20:27PM -0700, Alan Young wrote: I'm afraid I'm not getting what you mean by unique occurrence... Why is there only one unique occurrence of 'abc', when the string contains 'abc' four times? Why are there two unique occurrences of 'de', but only one of 'bc'?

Re: /$sudoku/

2006-05-17 Thread Ronald J Kimball
I presented Ilmari's /$sudoku/ scripts at the Boston.pm meeting last week. During the discussion, we thought of a further optimization. Ilmari's first version uses a generic regular expression. The second version hardcodes the known values into the negative-lookahead assertions. The

Re: code line of the day

2006-09-07 Thread Ronald J Kimball
On Thu, Sep 07, 2006 at 07:21:07AM -0700, Randal L. Schwartz wrote: Uri == Uri Guttman [EMAIL PROTECTED] writes: Uri @{$self-{templates}}{ keys %{$tmpls} } = Uri map ref $_ eq 'SCALAR' ? \${$_} : \$_, values %{$tmpls} ; Uri discuss amongst yourselves. topics include: what does

Re: decimal - Binary

2011-11-16 Thread Ronald J Kimball
On Wed, Nov 16, 2011 at 04:14:57PM +0100, Olof Johansson wrote: On 2011-11-16 09:57 -0500, Ronald J Kimball wrote: That should be s/0*//, otherwise you'll get the wrong result for numbers above 2147483647. That should be s/^0*//, otherwise you'll get the wrong result for numbers above

Re: decimal - Binary

2011-11-16 Thread Ronald J Kimball
On Wed, Nov 16, 2011 at 07:49:14PM +0100, Olof Johansson wrote: On 2011-11-16 11:57 -0500, Ronald J Kimball wrote: No, you are wrong. s/0*// is sufficient, because /0*/ will always match at the start of the string anyway. You're clearly an expert. I yield. Can you open a bug report

Re: decimal - Binary

2011-11-16 Thread Ronald J Kimball
On Wed, Nov 16, 2011 at 09:34:58PM +0100, Olof Johansson wrote: On 2011-11-16 14:14 -0500, Ronald J Kimball wrote: It's working as expected for me, so I'm not sure what needs to be fixed. Hum, now I'm ashamed. Sorry. But why is that not greedy? (I got other results earlier, but I can't

Re: seeking golfing advice

2012-05-16 Thread Ronald J Kimball
On Wed, May 16, 2012 at 04:40:40AM -0700, John Douglas Porter wrote: And of course, use grep, as others have said. @list[ grep !$_%2, 0..$#list ]; that gets you every other element, beginning with the first. ! has higher precedence than %, so this actually gets you just the first element.