[Omaha.pm] ignoring undefined subroutines

Terry td3201 at gmail.com
Tue Sep 7 15:15:04 CDT 2004


The reference still exists whether $who exists or not......if $who
isn't defined $coderef would still exist with '&header_'.

:\

On Tue, 07 Sep 2004 12:21:34 -0500, mØntar3 <m0ntar3 at cox.net> wrote:
> You might try capturing a reference and then varifying whether or not
> the reference is defined (or some such):
> 
>     $coderef = \&{"header_$who"};
>     if(defined $coderef) { &$coderef; };
> 
> 
> 
> Terry wrote:
> 
> >I want to ignore undefined subroutines.  Right now, my collection of
> >text ( not worthy of being called a perl script ) calls subroutines
> >but I want it to NOT die when it comes across a subroutine that is not
> >defined.  How can I do this?   For example:
> >
> >&{"header_$who"};
> >
> >if $who is not defined or contains a goofy value, my script dies, I do
> >not want this.
> >
> >Thanks!
> >Terry
> >_______________________________________________
> >Omaha-pm mailing list
> >Omaha-pm at mail.pm.org
> >http://www.pm.org/mailman/listinfo/omaha-pm
> >
> >
> >
>



More information about the Omaha-pm mailing list