please don't top post... On Thu, Apr 23, 2009 at 2:18 PM, Vance E. Neff <ven...@intouchmi.com> wrote:
<snip> > Well it turns out that error was caused by some other problem. I did > not realize that "our" was not a function. So you can't do something > like this: > our $variable = "value1" if (something is true); > our $variable = "value2" if (something else is true); > > I fixed that and things seem to working as expected. > > Thanks a lot! > > Vance > The general Perl idiom for that is to use the ?: ternary (a.k.a. "hook") operator: varialble = condition ? true_value : false_value; For instance: my $var = $x > 1 ? 'BIG X! : 'little x'; HTH, -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/