Re: Perl Christmas Quiz 2009

2009-12-01 Thread Mike Whitaker
On 1 Dec 2009, at 07:44, Ruud H.G. van Tol wrote: Abigail wrote: On Mon, Nov 30, 2009 at 06:24:12PM +, Chris Jack wrote: 7) Write a one line program that takes a non-negative integer as an argument and prints the square root when the answer's an integer. Restrictions: the perl line

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Philip Newton
On Tue, Dec 1, 2009 at 09:03, Mike Whitaker m...@altrion.org wrote: (this is not an answer) But this might be: echo 169 | perl -pe '/(\d+)(?{ $_ = sqrt($^N).\n })/;' Except it didn't follow the rules. Cheers, Philip -- Philip Newton philip.new...@gmail.com

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Nicholas Clark
On Mon, Nov 30, 2009 at 02:52:21PM -0800, Avleen Vig wrote: On Nov 30, 2009, at 14:43, Dave Hodgkinson daveh...@gmail.com wrote: How many people will be mildly irritated by starting a new thread with a Reply-to: to an existing one? Answer: none. We stopped being petty in 1997 and grew up :p

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Abigail
On Mon, Nov 30, 2009 at 11:40:04PM +, Chris Jack wrote: Abigail abig...@abigail.be wrote On Mon, Nov 30, 2009 at 06:24:12PM +, Chris Jack wrote: 7) Write a one line program that takes a non-negative integer as an argument and prints the square root when the answer's

Re: [Gllug-Social] [ANNOUNCE] London.pm December social 2009-12-03, The Prince Bonaparte, W2 5BE

2009-12-01 Thread Dan
Forgive my ignorance on this one. I'm not a perl programmer. I was assuming this was a perl/LUG meet. Does that sound about right? This will be my first LUGish meeting. Dan On Mon, Nov 30, 2009 at 1:18 PM, Lesley Binks lesl...@pgcroft.net wrote: On Sun, Nov 29, 2009 at 04:58:06PM +,

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Dirk Koopman
Avleen Vig wrote: On Nov 30, 2009, at 14:43, Dave Hodgkinson daveh...@gmail.com wrote: On 30 Nov 2009, at 18:24, Chris Jack wrote: Seeing as last year's quiz was mildly popular, Bonus question: How many people will be mildly irritated by starting a new thread with a Reply-to: to an

Re: Perl Christmas Quiz 2009

2009-12-01 Thread David Cantrell
On Mon, Nov 30, 2009 at 10:43:19PM +, Dave Hodgkinson wrote: Bonus question: How many people will be mildly irritated by starting a new thread with a Reply-to: to an existing one? Not as many as will be mildly irritated at me replying but chopping out the Reply-To. -- David Cantrell |

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Mark Zealey
7) Write a one line program that takes a non-negative integer as an argument and prints the square root when the answer's an integer. Restrictions: the perl line should be a regular expression. You are allowed to use the following functions/operators x, -, length, print plus any of

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Mark Morgan
I recall that as part of technical test I took for a previous role, to try and interpret and determine what it did. Quite cool, but the coolness was definitely exceeded by it's evilness... :) Mark. On Tue, Dec 1, 2009 at 11:26 AM, Abigail abig...@abigail.be wrote: which would be 'similar' but

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Matt Sergeant
On Mon, 30 Nov 2009 18:24:12 +, Chris Jack wrote: 1) Without running it to check, what does the following program output? my %a = (3,2,1,0); for my $b (sort values %a) { $b += 4; } print $a{1} . \n; Bizarrely enough, on both my Snow Leopard machines (default perl

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Matt Sergeant
On Tue, 1 Dec 2009 11:23:09 -0500, Matt Sergeant wrote: On Mon, 30 Nov 2009 18:24:12 +, Chris Jack wrote: 1) Without running it to check, what does the following program output? my %a = (3,2,1,0); for my $b (sort values %a) { $b += 4; } print $a{1} . \n; Bizarrely

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Randal L. Schwartz
Matt == Matt Sergeant mserge...@messagelabs.com writes: Matt On Mon, 30 Nov 2009 18:24:12 +, Chris Jack wrote: 1) Without running it to check, what does the following program output? my %a = (3,2,1,0); for my $b (sort values %a) { $b += 4; } print $a{1} . \n; Matt

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Dermot
2009/12/1 Matt Sergeant mserge...@messagelabs.com: On Tue, 1 Dec 2009 11:23:09 -0500, Matt Sergeant wrote: On Mon, 30 Nov 2009 18:24:12 +, Chris Jack wrote: 1) Without running it to check, what does the following program output? my %a = (3,2,1,0); for my $b (sort values %a) {     $b

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Philip Newton
On Tue, Dec 1, 2009 at 17:52, Dermot paik...@googlemail.com wrote: (not sure about this point) is a copy of the value in $a{1}. That's the salient point - it's an alias to the value in $a{1}, rather than a copy, since values %hash returns aliasses, sort just shuffles those aliasses, and foreach

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Randal L. Schwartz
Dermot == Dermot paik...@googlemail.com writes: Dermot My first impression was that it would be 4. However, without running Dermot it, I would say 0 on the basis that $b is scoped within the loop and Dermot (not sure about this point) is a copy of the value in $a{1}. That's the nice thing

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Dave Cross
On 12/01/2009 04:52 PM, Dermot wrote: 2009/12/1 Matt Sergeantmserge...@messagelabs.com: On Tue, 1 Dec 2009 11:23:09 -0500, Matt Sergeant wrote: On Mon, 30 Nov 2009 18:24:12 +, Chris Jack wrote: 1) Without running it to check, what does the following program output? my %a = (3,2,1,0);

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Dermot
2009/12/1 Philip Newton philip.new...@gmail.com: On Tue, Dec 1, 2009 at 17:52, Dermot paik...@googlemail.com wrote: (not sure about this point) is a copy of the value in $a{1}. That's the salient point - it's an alias to the value in $a{1}, rather than a copy, since values %hash returns

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Randal L. Schwartz
Matt == Matt Sergeant mserge...@messagelabs.com writes: Matt Yes. Though oddly enough it doesn't show up in the same terminal when Matt ssh'd into a Linux box. I'd like to know the reason why that is. Maybe linux doesn't echo the ^D as uparrow D? Or maybe linux adds a newline after it? Dunno.

Re: Perl Christmas Quiz 2009

2009-12-01 Thread Matt Sergeant
On Tue, 01 Dec 2009 08:47:55 -0800, Randal L. Schwartz wrote: Lemme guess. You did this: $ perl ... type program in here ... ^D (control D) The D is from your control D. Common misconception. Yes. Though oddly enough it doesn't show up in the same terminal when ssh'd into a Linux