Re: Quick silly question

2003-02-06 Thread Dominic Mitchell
Shevek wrote: Surely wossname has to be criterion wossname mumble foo. Maintailability. maintailability: the aspect of software causing a long tail of maintenance programmers to pore over it. -Dom -- | Semantico: creators of major online resources | | URL: http://www.semantico.

Re: Quick silly question

2003-02-05 Thread Shevek
On Wed, 5 Feb 2003, Graham Barr wrote: > On Wed, Feb 05, 2003 at 08:27:08AM -0800, Randal L. Schwartz wrote: > > > "Jasper" == Jasper McCrea <[EMAIL PROTECTED]> writes: > > > > Jasper> $h = { $_ => $h || {} } for reverse @r; > > > And that could be done as > > $h = reduce {{$b,$a}} {}, r

Re: Quick silly question

2003-02-05 Thread Graham Barr
On Wed, Feb 05, 2003 at 08:27:08AM -0800, Randal L. Schwartz wrote: > > "Jasper" == Jasper McCrea <[EMAIL PROTECTED]> writes: > > Jasper> $h = { $_ => $h || {} } for reverse @r; And that could be done as $h = reduce {{$b,$a}} {}, reverse @r; using List::Util, if it did not trigger a bug

Re: Quick silly question

2003-02-05 Thread Jasper McCrea
"Randal L. Schwartz" wrote: > > > "Jasper" == Jasper McCrea <[EMAIL PROTECTED]> writes: > > Jasper> $h = { $_ => $h || {} } for reverse @r; > > Autovivification makes the "|| {}" mostly unnecessary. OH YEAH!!! WELL FU^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H Paul's answer gave me the impression

Re: Quick silly question

2003-02-05 Thread Randal L. Schwartz
> "Jasper" == Jasper McCrea <[EMAIL PROTECTED]> writes: Jasper> $h = { $_ => $h || {} } for reverse @r; Autovivification makes the "|| {}" mostly unnecessary. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn

Re: Quick silly question

2003-02-05 Thread Randal L. Schwartz
> "Paul" == Paul Makepeace <[EMAIL PROTECTED]> writes: Paul> On Wed, Feb 05, 2003 at 09:53:28AM +, Roger Burton West wrote: >> On Wed, Feb 05, 2003 at 01:31:21AM -0800, Randy J. Ray wrote: >> >$s = $r; >> >for (@list) { $s = $s->{$_}; last unless ref $s; } >> >There's probably a trickier,

Re: Quick silly question

2003-02-05 Thread Paul Makepeace
On Wed, Feb 05, 2003 at 09:53:28AM +, Roger Burton West wrote: > On Wed, Feb 05, 2003 at 01:31:21AM -0800, Randy J. Ray wrote: > >$s = $r; > >for (@list) { $s = $s->{$_}; last unless ref $s; } > >There's probably a trickier, shorter "golf" solution, but I was never into > >obfuscated code writ

Re: Quick silly question

2003-02-05 Thread Jasper McCrea
Paul Makepeace wrote: > > On Wed, Feb 05, 2003 at 08:57:24AM +, Roger Burton West wrote: > > I have a list of elements of arbitrary length: qw(foo bar baz qux). I > > want to convert this into a deep hash reference: > > > > $r->{foo}{bar}{baz}{qux} > > > > Any easy way of doing this? > > $ pe

Re: Quick silly question

2003-02-05 Thread Simon Wistow
On Wed, Feb 05, 2003 at 11:49:51AM +, Tim Sweetman said: > *cough* premature optimisation *cough* ... Apparently reciting the times table or trying to remember all the FA Cup winners since the war really helps this. HTH, HAND Simon

Re: Quick silly question

2003-02-05 Thread Tim Sweetman
Joel Bernstein wrote: > > On Wed, Feb 05, 2003 at 09:53:28AM +, Roger Burton West wrote: > > On Wed, Feb 05, 2003 at 01:31:21AM -0800, Randy J. Ray wrote: > > >$s = $r; > > >for (@list) { $s = $s->{$_}; last unless ref $s; } > > >There's probably a trickier, shorter "golf" solution, but I was

Re: Quick silly question

2003-02-05 Thread Joel Bernstein
On Wed, Feb 05, 2003 at 09:53:28AM +, Roger Burton West wrote: > On Wed, Feb 05, 2003 at 01:31:21AM -0800, Randy J. Ray wrote: > >$s = $r; > >for (@list) { $s = $s->{$_}; last unless ref $s; } > >There's probably a trickier, shorter "golf" solution, but I was never into > >obfuscated code writ

Re: Quick silly question

2003-02-05 Thread Roger Burton West
On Wed, Feb 05, 2003 at 01:31:21AM -0800, Randy J. Ray wrote: >$s = $r; >for (@list) { $s = $s->{$_}; last unless ref $s; } >There's probably a trickier, shorter "golf" solution, but I was never into >obfuscated code writing... That makes sense; I was looking for a single-step transformation...

Re: Quick silly question

2003-02-05 Thread Randy J. Ray
On 2003.02.05 00:57 Roger Burton West wrote: I have a list of elements of arbitrary length: qw(foo bar baz qux). I want to convert this into a deep hash reference: $r->{foo}{bar}{baz}{qux} Any easy way of doing this? $s = $r; for (@list) { $s = $s->{$_}; last unless ref $s; } There's probably

Re: Quick silly question

2003-02-05 Thread Paul Makepeace
On Wed, Feb 05, 2003 at 08:57:24AM +, Roger Burton West wrote: > I have a list of elements of arbitrary length: qw(foo bar baz qux). I > want to convert this into a deep hash reference: > > $r->{foo}{bar}{baz}{qux} > > Any easy way of doing this? $ perl -MData::Dumper -le ' @r=qw(foo bar baz

Quick silly question

2003-02-05 Thread Roger Burton West
I have a list of elements of arbitrary length: qw(foo bar baz qux). I want to convert this into a deep hash reference: $r->{foo}{bar}{baz}{qux} Any easy way of doing this? Roger