Re: how to arrange a default action in a dispatch table

2010-05-10 Thread Harry Putnam
"John W. Krahn" writes: > Because /\A\d+\z/ has less ambiguity then /^\d+$/. "Dr.Ruud" writes: > And /\A[0-9]+\z/ is probably what was really meant. Got it, and thank you both. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.or

Re: how to arrange a default action in a dispatch table

2010-05-10 Thread Dr.Ruud
John W. Krahn wrote: /\A\d+\z/ has less ambiguity then /^\d+$/. And /\A[0-9]+\z/ is probably what was really meant. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
"John W. Krahn" writes: [...] > Why are you using push and sprintf? > >my @relist = "$r1name\n- -\n"; Much better... this is the only place I where I have anything that could even remotely be an excuse I tried using @relist, print "blah\n" Which didn't work then went t

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread John W. Krahn
Harry Putnam wrote: I'd like to be able to use the Lettered choices with a number too, but see no way other than taking user input at those choices. Is there a way to input NUMBER LETTER where the Number is not known in advance? In the example here... I've just taken more user input at the Lett

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread John W. Krahn
Harry Putnam wrote: Philip Potter writes: I was asking, not suggesting one over the other. Â And was not offering an opinion on it don't now enough. You've trimmed the context I was referring to. But you said: But there are no trailing new lines.. guaranteed by: [example snipped] which

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Uri Guttman
> "HP" == Harry Putnam writes: HP> "Uri Guttman" writes: >> yes, i disable syntax coloring since it makes it HARDER for me to >> see HP> [...] HP> I'm terrible about leaving out one of "" '' () {} [] etc.. Emacs catches HP> them and leads me to them pretty quickly with syntax

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
Philip Potter writes: >> I was asking, not suggesting one over the other.  And was not offering >> an opinion on it don't now enough. > > You've trimmed the context I was referring to. But you said: > >> But there are no trailing new lines.. guaranteed by: [example snipped] > > which looks li

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
"John W. Krahn" writes: [...] > Much simpler as: > > for ( my $i = 0; $i <= $#ar1; $i += 3 ) { > dispt( $r1name, @ar1[ $i .. $i + 2 ] ); > } Trying to make use of you suggestions. And has resulted in a much tidier script. I may have tortured you examples beyond recognition, and ha

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Philip Potter
On 8 May 2010 15:43, Harry Putnam wrote: > Philip Potter writes: > >> You are quite correct - there is no practical difference in this situation. >> >> [nitpick: actually, if $/ has been set to something other than "\n", >> $chosen may have a trailing "\n" character.] > > I was asking, not sugges

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
Philip Potter writes: > You are quite correct - there is no practical difference in this situation. > > [nitpick: actually, if $/ has been set to something other than "\n", > $chosen may have a trailing "\n" character.] I was asking, not suggesting one over the other. And was not offering an op

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Philip Potter
On 8 May 2010 14:47, Harry Putnam wrote: > Philip Potter writes: >> On 8 May 2010 13:35, Harry Putnam wrote: >>> I'm curious about one thing I see there: >>> >>>  `/\A\d+\z/ ' as opposed to `/^\d+$/' >>> >>> in this snippet: >>> >>>        if ( $chosen =~ /\A\d+\z/ && $chosen >= 1 && $chosen <=

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
Harry Putnam writes: > You mentioned once being an emacs user. > I notice when I write arrays qw like suggested... It confuses the > syntax highlight in cperl-mode and throws the highlight completely out > the window. Emacs is apparently using the quotes as part of how it > finds what to highli

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
Shawn H Corey writes: > Harry Putnam wrote: >> Steve Bertrand writes: >> >>> use vi(m). >> >> Oh my god... the `V' word. I'll have to gouge my eyes out now, just >> from looking. >> >> > Then use cream :D I just meant I'm a dedicated emacs user for coding. I do

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
Philip Potter writes: > On 8 May 2010 13:35, Harry Putnam wrote: >> I'm curious about one thing I see there: >> >>  `/\A\d+\z/ ' as opposed to `/^\d+$/' >> >> in this snippet: >> >>        if ( $chosen =~ /\A\d+\z/ && $chosen >= 1 && $chosen <= @h ) { >>            print "Taking some action on $

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Philip Potter
On 8 May 2010 13:35, Harry Putnam wrote: > I'm curious about one thing I see there: > >  `/\A\d+\z/ ' as opposed to `/^\d+$/' > > in this snippet: > >        if ( $chosen =~ /\A\d+\z/ && $chosen >= 1 && $chosen <= @h ) { >            print "Taking some action on $h[$chosen - 1]\n"; >            la

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
"John W. Krahn" writes: > Much simpler as: > > for ( my $i = 0; $i <= $#ar1; $i += 3 ) { > dispt( $r1name, @ar1[ $i .. $i + 2 ] ); > } [...] Man, that is a heck of a lot tidier. I was completely unfamiliar with that way of getting at parts of an array (though now I remember seeing some

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Philip Potter
On 8 May 2010 13:09, Harry Putnam wrote: > "Uri Guttman" writes: > >> yes, i disable syntax coloring since it makes it HARDER for me to >> see > > [...] > > I'm terrible about leaving out one of "" '' () {} [] etc.. I always enter them in pairs. eg I first type if (condition) {} then put the c

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
"Uri Guttman" writes: > yes, i disable syntax coloring since it makes it HARDER for me to > see [...] I'm terrible about leaving out one of "" '' () {} [] etc.. Emacs catches them and leads me to them pretty quickly with syntax hilight. my @ar = ( "one", "two". "three",

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Shawn H Corey
Harry Putnam wrote: Steve Bertrand writes: use vi(m). Oh my god... the `V' word. I'll have to gouge my eyes out now, just from looking. Then use cream :D -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Harry Putnam
Steve Bertrand writes: > use vi(m). Oh my god... the `V' word. I'll have to gouge my eyes out now, just from looking. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Uri Guttman
> "HP" == Harry Putnam writes: HP> "Uri Guttman" writes: >> i haven't looked at the previous code but why is that being cleared here >> and pushed above? i don't get the purpose of the mod counter either. it >> just seems very odd but maybe there is a purpose. i won't delve to find

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 21:09, Harry Putnam wrote: > "Uri Guttman" writes: > >> i haven't looked at the previous code but why is that being cleared here >> and pushed above? i don't get the purpose of the mod counter either. it >> just seems very odd but maybe there is a purpose. i won't delve to find >> o

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread John W. Krahn
Harry Putnam wrote: Summary: How to arrange for a default action in a dispatch table, along with several single Letter choics and numeric choices. Details: This script is a mock up of something I'm trying to do, and is way pared down from a much larger script... mostly its the dispatch table I

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Harry Putnam
Steve Bertrand writes: > Although I've expanded this out of a dispatch table and modified it to > prevent wrap, it is extremely understandable, even without further context: > > my $v4glue = $dns->v4glue(); > my $v6glue = $dns->v6glue(); > > $self->data({ field => 'v4glue', value => $self->date

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Harry Putnam
"Uri Guttman" writes: > i haven't looked at the previous code but why is that being cleared here > and pushed above? i don't get the purpose of the mod counter either. it > just seems very odd but maybe there is a purpose. i won't delve to find > out. The mod counter being cleared was just stupi

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> On 2010.05.07 19:37, Steve Bertrand wrote: >> (fwiw, and I don't have time to get into the rest of the code right now, >> I prefer whitespace, so I'd write that as): >> >> my @ar1 = qw ( >> r2one >> r2two >> r2three # comment, reader needs

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 19:37, Steve Bertrand wrote: > (fwiw, and I don't have time to get into the rest of the code right now, > I prefer whitespace, so I'd write that as): > > my @ar1 = qw ( > r2one > r2two > r2three # comment, reader needs info for this var >

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 19:58, Uri Guttman wrote: >> "SB" == Steve Bertrand writes: > SB> (fwiw, and I don't have time to get into the rest of the code right now, > SB> I prefer whitespace, so I'd write that as): > > SB> my @ar1 = qw ( > SB> r2one > SB> r2two

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> On 2010.05.07 19:02, Harry Putnam wrote: >> It looks pretty awkward, the way I just kind of wedged the default >> action in there... is there a more canonical way of doing that? SB> I have to be honest ;) SB> There was a time a little while bac

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 19:37, Steve Bertrand wrote: > On 2010.05.07 19:02, Harry Putnam wrote: > >> It looks pretty awkward, the way I just kind of wedged the default >> action in there... is there a more canonical way of doing that? > > I have to be honest ;) > > There was a time a little while back tha

Re: how to arrange a default action in a dispatch table

2010-05-07 Thread Steve Bertrand
On 2010.05.07 19:02, Harry Putnam wrote: > It looks pretty awkward, the way I just kind of wedged the default > action in there... is there a more canonical way of doing that? I have to be honest ;) There was a time a little while back that I decided that I would try hard not to troubleshoot cod

how to arrange a default action in a dispatch table

2010-05-07 Thread Harry Putnam
Summary: How to arrange for a default action in a dispatch table, along with several single Letter choics and numeric choices. Details: This script is a mock up of something I'm trying to do, and is way pared down from a much larger script... mostly its the dispatch table I'm working on right n