what do you mean I cant?  It is logically working!  Is this is
recommedation for more readibility and thats it?  Or is this Perl best
practice thingy?

thank you!


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




                                                                           
             "Charles K.                                                   
             Clarkson"                                                     
             <[EMAIL PROTECTED]                                          To 
             .net>                     <beginners-cgi@perl.org>            
                                                                        cc 
             09/13/2005 02:02                                              
             PM                                                    Subject 
                                       RE: Use of uninitialized value      
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] wrote:

: I'd rather send the whole thing b/c I also would like a critique
: as well. Here she is!

    First glaring item: you cannot nest subroutines. To perl, the
following are equivalent.


===========
print "blah";
if ( $which_radio_button eq 'All-Clients' ) {
    &viewall();

    sub viewall {
        # do something;
    }

} elsif ( $which_radio_button eq 'Backup-Tapes' ) {
    &viewbkups();
    sub viewbkups {
        # do something else;
    }
}


===========

print "blah";
if ( $which_radio_button eq 'All-Clients' ) {
    viewall();

} elsif ( $which_radio_button eq 'Backup-Tapes' ) {
    viewbkups();
}

sub viewall {
    # do something;
}

sub viewbkups {
    # do something else;
}

===========

    So there's no advantage to placing the subs in line and taking
them out makes your code more readable.


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


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





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


Reply via email to