On Thu, Oct 16, 2008 at 03:20:13AM -0700, Jeff Pang wrote:
> --- On Thu, 10/16/08, sanket vaidya <[EMAIL PROTECTED]> wrote:
> > From: Chas. Owens [mailto:[EMAIL PROTECTED] 
> >
> > > What you really want to say is
> > >
> > > print $string eq "test" ? "correct" : "";

print "correct" if $str eq "test";

> > How can I write
> > 
> > if ($string eq "test") {
> >     print "correct"
> > } else {
> >     die "others"
> > }
> > 
> > In above way?
> 
> $string eq "test" ? print "correct" : die "others";
> But I don't think this is a recommended syntax.

die "others" unless $string eq "test";
print "correct";

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to