Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] if and else

Expand Messages
  • Tom Barron
    Yes! Greg s example made me think of this: @colors = ( blue , red ); $barcolor = $color[($value1
    Message 1 of 8 , Jun 7, 2000
    • 0 Attachment
      Yes! Greg's example made me think of this:

      @colors = ('blue', 'red');
      $barcolor = $color[($value1 < $value1alarm) || ($value2 !=
      $value2alarm)];

      tb :)

      Greg Webster wrote:
      >
      > This is a perfect example of how Perl can do one thing 1000 different ways...
      >
      > %colors = ('blue', 'red');
      > unless ($value1 > $value1alarm || $value2 == $value2alarm)
      > {$barcolor = $colors[0]}
      > else {$barcolor = $colors[1]}
      >
      > Still not as clean as Olivers example though.
      >
      > Greg
      >
      > On Wed, 07 Jun 2000, you wrote:
      > > hehe sorry but i had to add my 1cent worth ! hehehe
      > >
      > > $barcolor = "blue.gif";
      > > $barcolor = "red.gif" if ($value1 < $value1alarm || $value2 !=
      > > $value2alarm);
      > >
      > > - Oliver
      > >
      > > -----Original Message-----
      > > From: barron@... [mailto:barron@...]On Behalf Of
      > > Tom Barron
      > > Sent: 07 June 2000 03:29
      > > To: perl-beginner@egroups.com
      > > Subject: Re: [PBML] if and else
      > >
      > >
      > > Greg Webster wrote:
      > > >
      > > > > if ($value1 < $value1alarm) { $barcolor="red.gif"; }
      > > > > if ($value2 > $value2alarm) { $barcolor="red.gif"; }
      > > > > if ($value2 < $value2alarm) { $barcolor="red.gif"; }
      > > > > else { $barcolor="blue.gif"; }
      > > >
      > > > Or even better:
      > > >
      > > > if ($value1 < $value1alarm || $value2 > $value2alarm || $value2 <
      > > $value2alarm)
      > > > {$barcolor="red.gif"; }
      > > > else
      > > > {$barcolor="blue.gif";}
      > >
      > > Or even more better: :)
      > >
      > > $barcolor = "blue.gif";
      > > if ($value1 < $value1alarm || $value2 != $value2alarm)
      > > {$barcolor="red.gif"; }
      > >
      > > tb
      > >
      > > ------------------------------------------------------------------------
      > > IT Professionals: Match your unique skills with the best IT projects at
      > > http://click.egroups.com/1/3381/2/_/12898/_/960384768/
      > > ------------------------------------------------------------------------
      > >
      > >
      > >
      > >
      > >
      > > ------------------------------------------------------------------------
      > > Take your development to new heights. Work with clients like Dell and
      > > pcOrder. Submit your resume to jobs@.... Visit us at
      > > http://click.egroups.com/1/4358/2/_/12898/_/960385686/
      > > ------------------------------------------------------------------------
      > --
      > <>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<>
      > / \ GREG WEBSTER - greg@... / \/ \/ \
      > \ / http://www.geekrights.org \ /\ /\ /
      > <>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<>
      >
      > ------------------------------------------------------------------------
      > Remember four years of good friends, bad clothes, explosive chemistry
      > experiments.
      > http://click.egroups.com/1/4051/2/_/12898/_/960425017/
      > ------------------------------------------------------------------------
    • Greg Webster
      Very nice! I noticed I screwed up the array in mine after I sent it...(I was dealing with a stupid multidimensional array all day today). Yours should have one
      Message 2 of 8 , Jun 7, 2000
      • 0 Attachment
        Very nice! I noticed I screwed up the array in mine after I sent it...(I was
        dealing with a stupid multidimensional array all day today).

        Yours should have one change however:

        @colors = ('blue','red');
        $barcolor = "$color[($value1 < $value1alarm) || ($value2 !=
        $value2alarm)]".".gif";

        Greg


        On Wed, 07 Jun 2000, you wrote:
        > Yes! Greg's example made me think of this:
        >
        > @colors = ('blue', 'red');
        > $barcolor = $color[($value1 < $value1alarm) || ($value2 !=
        > $value2alarm)];
        >
        > tb :)
        >
        > Greg Webster wrote:
        > >
        > > This is a perfect example of how Perl can do one thing 1000 different ways...
        > >
        > > %colors = ('blue', 'red');
        > > unless ($value1 > $value1alarm || $value2 == $value2alarm)
        > > {$barcolor = $colors[0]}
        > > else {$barcolor = $colors[1]}
        > >
        > > Still not as clean as Olivers example though.
        > >
        > > Greg
        > >
        > > On Wed, 07 Jun 2000, you wrote:
        > > > hehe sorry but i had to add my 1cent worth ! hehehe
        > > >
        > > > $barcolor = "blue.gif";
        > > > $barcolor = "red.gif" if ($value1 < $value1alarm || $value2 !=
        > > > $value2alarm);
        > > >
        > > > - Oliver
        > > >
        > > > -----Original Message-----
        > > > From: barron@... [mailto:barron@...]On Behalf Of
        > > > Tom Barron
        > > > Sent: 07 June 2000 03:29
        > > > To: perl-beginner@egroups.com
        > > > Subject: Re: [PBML] if and else
        > > >
        > > >
        > > > Greg Webster wrote:
        > > > >
        > > > > > if ($value1 < $value1alarm) { $barcolor="red.gif"; }
        > > > > > if ($value2 > $value2alarm) { $barcolor="red.gif"; }
        > > > > > if ($value2 < $value2alarm) { $barcolor="red.gif"; }
        > > > > > else { $barcolor="blue.gif"; }
        > > > >
        > > > > Or even better:
        > > > >
        > > > > if ($value1 < $value1alarm || $value2 > $value2alarm || $value2 <
        > > > $value2alarm)
        > > > > {$barcolor="red.gif"; }
        > > > > else
        > > > > {$barcolor="blue.gif";}
        > > >
        > > > Or even more better: :)
        > > >
        > > > $barcolor = "blue.gif";
        > > > if ($value1 < $value1alarm || $value2 != $value2alarm)
        > > > {$barcolor="red.gif"; }
        > > >
        > > > tb
        > > >
        > > > ------------------------------------------------------------------------
        > > > IT Professionals: Match your unique skills with the best IT projects at
        > > > http://click.egroups.com/1/3381/2/_/12898/_/960384768/
        > > > ------------------------------------------------------------------------
        > > >
        > > >
        > > >
        > > >
        > > >
        > > > ------------------------------------------------------------------------
        > > > Take your development to new heights. Work with clients like Dell and
        > > > pcOrder. Submit your resume to jobs@.... Visit us at
        > > > http://click.egroups.com/1/4358/2/_/12898/_/960385686/
        > > > ------------------------------------------------------------------------
        > > --
        > > <>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<>
        > > / \ GREG WEBSTER - greg@... / \/ \/ \
        > > \ / http://www.geekrights.org \ /\ /\ /
        > > <>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<>
        > >
        > > ------------------------------------------------------------------------
        > > Remember four years of good friends, bad clothes, explosive chemistry
        > > experiments.
        > > http://click.egroups.com/1/4051/2/_/12898/_/960425017/
        > > ------------------------------------------------------------------------
        >
        > ------------------------------------------------------------------------
        > Remember four years of good friends, bad clothes, explosive chemistry
        > experiments.
        > http://click.egroups.com/1/4051/2/_/12898/_/960426790/
        > ------------------------------------------------------------------------
        --
        <>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<>
        / \ GREG WEBSTER - greg@... / \/ \/ \
        \ / http://www.geekrights.org \ /\ /\ /
        <>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<><>-<>
      Your message has been successfully submitted and would be delivered to recipients shortly.