RE: One line variable declaration with multiple conditions

2004-01-08 Thread Dan Muey
> > I think I better see the context at this point. > note, as I presume you did The issue is resolved, but for the die hards here goes... I'm wanted to figure out my method of attack before I did the whole thing but here is an example that will illustrate the basic idea hopefully: #!/usr/bin/p

Re: One line variable declaration with multiple conditions

2004-01-08 Thread drieux
On Jan 8, 2004, at 10:38 AM, Dan Muey wrote: [..] The vars to be assigned ($var1, $var2,etc...) come from a database query so they are handled already earlier. So how they are declared are irrelevant to the issue. (Yes they must be initialized for a warnings safe environment and they are, just assu

RE: One line variable declaration with multiple conditions

2004-01-08 Thread Dan Muey
> On Jan 8, 2004, at 7:45 AM, Dan Muey wrote: > [..] > > > > Except I need to do this to about ten variabels all in a row. Which > > gives me 10 lines with Bob's way and 40 with my very first example. > > Boo for that! :) > > > [..] > > Have you thought about a simplification process? > One of t

Re: One line variable declaration with multiple conditions

2004-01-08 Thread drieux
On Jan 8, 2004, at 7:45 AM, Dan Muey wrote: [..] Except I need to do this to about ten variabels all in a row. Which gives me 10 lines with Bob's way and 40 with my very first example. Boo for that! :) [..] Have you thought about a simplification process? One of the tricks I do is say my ($var1,$

RE: One line variable declaration with multiple conditions

2004-01-08 Thread Dan Muey
> Dan Muey wrote: > > > BTW - I'm not really using these variable names, only using > them here > > ot help clarify my goal. > > Why not? They looked very good to me, at least in the > context of the question at hand. One of the best aspects of In context yes, but the really really long w

RE: One line variable declaration with multiple conditions

2004-01-08 Thread Dan Muey
> Dan Muey wrote: > > > Howdy list. > > I'm trying to one lineify this: > > > > my $guts = $firstchoice || ''; > > if(!$guts && $use_second_choice_if_first_is_empty) { > > $guts = $secondchoice; > > } > > > > Basically > > my $guts = $firstchoice || $secondchoic || ''; > > Would be perfect

Re: One line variable declaration with multiple conditions

2004-01-07 Thread R. Joseph Newton
Dan Muey wrote: > BTW - I'm not really using these variable names, only using them here ot help > clarify my goal. Why not? They looked very good to me, at least in the context of the question at hand. One of the best aspects of Perl, IMHO, is that it allows you to just say what you mean. I

Re: One line variable declaration with multiple conditions

2004-01-07 Thread R. Joseph Newton
Dan Muey wrote: > Howdy list. > I'm trying to one lineify this: > > my $guts = $firstchoice || ''; > if(!$guts && $use_second_choice_if_first_is_empty) { > $guts = $secondchoice; > } > > Basically > my $guts = $firstchoice || $secondchoic || ''; > Would be perfect except I only want to let

RE: One line variable declaration with multiple conditions

2004-01-07 Thread Dan Muey
> > Howdy list. > > I'm trying to one lineify this: > > > > my $guts = $firstchoice || ''; > > if(!$guts && $use_second_choice_if_first_is_empty) { > > $guts = $secondchoice; > > } > > > > Basically > > my $guts = $firstchoice || $secondchoic || ''; > > Would be perfect except I only want t

RE: One line variable declaration with multiple conditions

2004-01-07 Thread Dan Muey
> Dan Muey wrote: > > Howdy list. > > I'm trying to one lineify this: > > > > my $guts = $firstchoice || ''; > > if(!$guts && $use_second_choice_if_first_is_empty) {$guts = > > $secondchoice; } > > > > Basically > > my $guts = $firstchoice || $secondchoic || ''; > > Would be perfect excep

RE: One line variable declaration with multiple conditions

2004-01-07 Thread Dan Muey
> > Howdy list. > > I'm trying to one lineify this: > > > > my $guts = $firstchoice || ''; > > if(!$guts && $use_second_choice_if_first_is_empty) { > > $guts = $secondchoice; > > } > > > > Basically > > my $guts = $firstchoice || $secondchoic || ''; > > Would be perfect except I only want t

RE: One line variable declaration with multiple conditions

2004-01-07 Thread Dan Muey
> > On Jan 7, 2004, at 2:20 PM, Dan Muey wrote: > > > > > Is that possible to do with one line? > > technically no, because you needed > my ($firstchoice, $use_second_choice_if_first_is_empty); > my $secondchoice = 's2'; Sorry, I figured we could assume they were declared earlier so as not to

Re: One line variable declaration with multiple conditions

2004-01-07 Thread drieux
On Jan 7, 2004, at 2:20 PM, Dan Muey wrote: Is that possible to do with one line? technically no, because you needed my ($firstchoice, $use_second_choice_if_first_is_empty); my $secondchoice = 's2'; then you can do my $guts = ($use_second_choice_if_first_is_empty)? $secondchoice : $firstchoice |

Re: One line variable declaration with multiple conditions

2004-01-07 Thread Wiggins d Anconia
> Howdy list. > I'm trying to one lineify this: > > my $guts = $firstchoice || ''; > if(!$guts && $use_second_choice_if_first_is_empty) { > $guts = $secondchoice; > } > > Basically > my $guts = $firstchoice || $secondchoic || ''; > Would be perfect except I only want to let it use $se

RE: One line variable declaration with multiple conditions

2004-01-07 Thread Bob Showalter
Dan Muey wrote: > Howdy list. > I'm trying to one lineify this: > > my $guts = $firstchoice || ''; > if(!$guts && $use_second_choice_if_first_is_empty) { $guts = > $secondchoice; } > > Basically > my $guts = $firstchoice || $secondchoic || ''; > Would be perfect except I only want to let it use