if(wantarray){...}else{...}
- From: "Stumproot" <burlo.stumproot@xxxxxxxxx>
- Date: 10 Apr 2005 14:12:28 -0700
Posted from/using google news.
I have "return" snippets like this in several funktions
and I'm getting tired of writing them.
Is there a better way?
sub fun1 {
.
.
.
lots going on
.
.
# Start return snippet
if(wantarray) {
my @res = A_Funktion($a1,$a2);
return @res;
} else {
return A_Funktion($a1,$a2);
}
# End return snippet
}
sub fun2 {
.
.
.
lots going on
.
.
# Start return snippet
if(wantarray) {
my @res = Another_Funktion($a1,$a2);
return @res;
} else {
return Another_Funktion($a1,$a2);
}
# End return snippet
}
and several more...
.
- Follow-Ups:
- Re: if(wantarray){...}else{...}
- From: Tad McClellan
- Re: if(wantarray){...}else{...}
- From: A. Sinan Unur
- Re: if(wantarray){...}else{...}
- Prev by Date: Re: How to create an empty file? (second attempt)
- Next by Date: Re: if(wantarray){...}else{...}
- Previous by thread: newbie baffled by de/referencing with subroutines
- Next by thread: Re: if(wantarray){...}else{...}
- Index(es):
Relevant Pages
|