That way works for me but I find this way of writing it to be more easily grokkable:
sub file { my $self = shift; @_ ? $self->{file} = shift : $self->{file}; }
update hmm, sorry, that doesn't do exactly what you want I suppose. But you could always substitute $self->{file} or even $self->file() in place of $file through the rest of the method ... but, as my physics instructor never said, "whatever applies sufficient surface tension underneath your watercraft to maintain it above the liguid-gas boundary."
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
In reply to Re: choosing and/or overriding defaults for a sub argument
by arturo
in thread choosing and/or overriding defaults for a sub argument
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |