Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • by Theory (10) on 2003.11.03 20:13 (#25441) Homepage Journal
    sub convert_to_list {
        my $self = shift;
        # Return knows if it's a scalar or array context!
        my $args = $self->arguments or return;
        return split / (?=-)/, $args;
    }
    • In theory, that looks good and if I were calling the shots, it would be. However, consider the following:

      some_func(other_func1(), other_func2());

      If one of the "other funcs" has a bare return, some_func() will be passed a list with only one element! You can get around this by prepending the function calls with scalar, but that is not done in the shop I work at, yet function calls are often embedded in other function calls. Thus, we have explicit return values. If only one value is being returned, we