zip:
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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.