Re: better way of writing this script

2011-04-29 Thread Rob Dixon
On 29/04/2011 13:17, C.DeRykus wrote: This happened in 5.10 ... at least after 5.8. From: http://rt.perl.org/rt3/Ticket/Display.html?id=89024 Just like the argument list of sub calls, The list over which foreach iterates is evaluated in lvalue context as required by foreach's al

Re: better way of writing this script

2011-04-29 Thread C.DeRykus
On Apr 29, 2:39 am, u...@stemsystems.com ("Uri Guttman") wrote: > > "RD" == Rob Dixon writes: > >   RD> On 29/04/2011 10:27, Uri Guttman wrote: > >   RD> Good call Brian. It's not at all obvious that all the elements of a hash >   RD> slice will be created if they don't exist :) >   >> >   >>

Re: better way of writing this script

2011-04-29 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> On 29/04/2011 10:27, Uri Guttman wrote: RD> Good call Brian. It's not at all obvious that all the elements of a hash RD> slice will be created if they don't exist :) >> >> and they won't be anyhow. you need have lvalues to autovivify hash (or >> a

Re: better way of writing this script

2011-04-29 Thread Rob Dixon
On 29/04/2011 10:27, Uri Guttman wrote: "RD" == Rob Dixon writes: RD> On 29/04/2011 09:15, Brian Fraser wrote: >> On Fri, Apr 29, 2011 at 5:02 AM, Uri Guttman wrote: >>> >>> so you can streamline yours with a slice: >>> >>> my $status = join '', grep defined, @jvalue{

Re: better way of writing this script

2011-04-29 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> On 29/04/2011 09:15, Brian Fraser wrote: >> On Fri, Apr 29, 2011 at 5:02 AM, Uri Guttman wrote: >>> >>> so you can streamline yours with a slice: >>> >>> my $status = join '', grep defined, @jvalue{ 0 .. 5 } ; >> >> This one was on purpose t

Re: better way of writing this script

2011-04-29 Thread Rob Dixon
On 29/04/2011 09:15, Brian Fraser wrote: On Fri, Apr 29, 2011 at 5:02 AM, Uri Guttman wrote: so you can streamline yours with a slice: my $status = join '', grep defined, @jvalue{ 0 .. 5 } ; This one was on purpose though - The slice might insert new keys into the hash, and I recently spent

Re: better way of writing this script

2011-04-29 Thread Brian Fraser
On Fri, Apr 29, 2011 at 5:02 AM, Uri Guttman wrote: > > also why use qw for sequential numbers when a range will do? > > Because I went stupid and just blindly copypasted instead of thinking :) Seriously, why use qw when I'm not _quoting words_? > so you can streamline yours with a slice: > > m

Re: better way of writing this script

2011-04-29 Thread Uri Guttman
> "BF" == Brian Fraser writes: BF> On Fri, Apr 29, 2011 at 4:27 AM, Agnello George wrote: >> Hi All >> >> is there a better way of writing this script >> >> BF> "Better" is fairly subjective - And with only a part of the program, there BF> isn't much that can be said. Is

Re: better way of writing this script

2011-04-29 Thread Agnello George
On Fri, Apr 29, 2011 at 1:09 PM, Uri Guttman wrote: >> "AG" == Agnello George writes: > >  AG> is there a better way of writing this script > > this is not a script but a short code snippet. there are many ways to > redo this. many questions could be asked as well. > >  AG>  my @resultss = qw

Re: better way of writing this script

2011-04-29 Thread Uri Guttman
> "AG" == Agnello George writes: AG> is there a better way of writing this script this is not a script but a short code snippet. there are many ways to redo this. many questions could be asked as well. AG> my @resultss = qw( 0 1 2 3 4 5 ) ; is that always a fixed list? could @jvalue h

Re: better way of writing this script

2011-04-29 Thread Brian Fraser
On Fri, Apr 29, 2011 at 4:27 AM, Agnello George wrote: > Hi All > > is there a better way of writing this script > > "Better" is fairly subjective - And with only a part of the program, there isn't much that can be said. Is $status a global variable, or lexical? On the other hand, if you mean mo