&feed; is the call to the subroutine. You wrap the call in an eval-block and check $@ to see if the subroutine died or not.
- In general, if you think something isn't in Perl, try it out, because it usually is. :-)
- "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
| [reply] [d/l] |
eval {
&feed;
}; unless ( $@ ) {
&error;
}
sub feed {
...code...
while($l < $2) {
...code...
}
die "Could not retreive data";
}
And it seems to be working. | [reply] [d/l] |
If it seems to be working, then it is a remarkable form of working, because the logic is backwards from what dragonchild posted. Notice that after the eval, his code acted on the error if $@ evaluated to true, while yours acts on the error if $@ is false (i.e. when there are actually no errors).
| [reply] |