Thanks for replying Anonymous Monk. Yes, my data is right. I printed it out. Also, if I use if condition without the &&, it works. I am totally confused. Here is what worked:
sub validate_date { my $start_date = $_[0]; my $end_date = $_[1]; my $today_date = $_[2]; my @start_date_array = split(/\//, $start_date); my @end_date_array = split(/\//, $end_date); my @today_date_array = split(/\//, $today_date); my $error_msg = ""; if (!$start_date || !$end_date){ $error_msg = "Blank Field in Date field. Please Use Browser Ba +ck button and Enter Date Field"}; # if ( (@start_date_array[0] > @today_date_array[0]) && (@start_ +date_array[1] > @today_date_array[1]) && (@start_date_array[2] > @tod +ay_date_array[2])) { if (@start_date_array[0] > @today_date_array[0]) { $error_msg = "Start Date can not be a Future Date. Please Use +Browser Back button and Enter Start Date"}; if ( (@end_date_array[0] > @today_date_array[0]) && (@end_date +_array[1] > @today_date_array[1]) && (@end_date_array[2] > @today_dat +e_array[2])) { $error_msg = "End Date can not be a Future Date. Please Use Br +owser Back button and Enter End Date"}; return $error_msg; }

In reply to Re^2: if && condition not working by rakheek
in thread if && condition not working by rakheek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.