Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Comment on



Stricken as part of the update (below) because this is just plain wrong: Despite the title (and what I construe to be needless use of Data::FormValidator) /me thinks your problem is the attempt at comparison in your first sub.

Here's my stab at what I think (lacking code that does actually compile) you intend:

#!/usr/bin/perl # 871571 use strict; use warnings; my $num1 = 4; my $num2 = 4; my ($return1, $return2) = compare_num1_LT_num2($num1, $num2); print "\tBACK IN MAIN: \n"; { no warnings ("uninitialized"); if ($return1 eq 'NoWay') { print "\t $num1 is GT or EQUAL to $num2\n"; } else { print "\$return1: $return1 and \$return2: $return2\n\n"; } } print "Done\n\n"; sub compare_num1_LT_num2 { my ($first, $second) = @_; print "In sub compare... $first, $second\n"; if ( $first >= $second ) { return ('NoWay'); } else { return ( $first, $second ); } }

which returns

In sub compare... 4, 4 BACK IN MAIN: 4 is GT or EQUAL to 4 Done

Change $num1 to 3, and this is the output:

In sub compare... 3, 4 BACK IN MAIN: $return1: 3 and $return2: 4 Done

Lottsa' un-needed code and detail here... but that's the way my mind works (when it works).

Update (1712 EST): Based on exchange of msgs and a much needed bit of education (FROM thezip to /me), the compare...() returns 1 or 0, T or F, which is then supposed to be parsed by Data::FormValidator... meaning that portion of my reply (above) is probably most valuable as an object lesson to those ( points to self) who would mis-interpret a bit of legit syntax. Apologies.

In reply to Re: How do I code multiple failure modes for Data::FormValidator field validations? by ww
in thread How do I code multiple failure modes for Data::FormValidator field validations? by thezip

and:  <code> code here </code>

  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (11)
    As of 2014-12-27 19:28 GMT
    Find Nodes?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?

      Results (177 votes), past polls