Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


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

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



  • 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.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-26 00:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found