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.
  • Personally, I hate the style where you test something at the beginning of a statement and then do something if it's true by using and. I much prefer using if or unless at the end of a statement:

        my $_combination_info = {};
        sub combination_info {
            my $self = shift;
            $_combination_info->{ $self->csv_file_name } = shift if @_;
            return $_combination_info->{ $self->csv_file_name };
        }

    I use this style all the time. But I have to say, I don't think that your original example was clever, but indicative of someone who prefers a different style of handling one-line conditionals. I would even argue that it's not really idiomatic Perl, but it's not in any way clever.

    --Theory