Spidy has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on something that involves using a switch() statement to call different subroutines based on the values inside a hash. Here is what the code looks like:
use Switch; switch(%A) { case 'sloven' { $responseXML .= sloven('xml') } case 'leggert' { $responseXML .= wiggedy() } ... }
...And so on. This is all well and good, but in every single case, I'm appending to $responseXML. In keeping with the Perlish quality of laziness, is there a way to append to $responseXML in every case, without having to type it every time?
Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Appending to variable with a switch statement?
by jbert (Priest) on Jan 06, 2007 at 21:39 UTC | |
|
Re: Appending to variable with a switch statement?
by jhourcle (Prior) on Jan 06, 2007 at 21:40 UTC | |
|
Re: Appending to variable with a switch statement?
by diotalevi (Canon) on Jan 06, 2007 at 21:26 UTC | |
|
Re: Appending to variable with a switch statement?
by Joost (Canon) on Jan 06, 2007 at 21:26 UTC |