Hi, I have a question related to the following code pasted below.
sub new { my ($class, $options) = @_; if (!ref $options) { shift @_; $options = scalar @_ ? {@_} : {}; } #Some Code bless $self, $class; #Some Code return $self; }
I am confused what the line
$options = scalar @_ ? {@_} : {};does in this code. What happens to $options after it is executed?
In reply to Creating 'new' subroutine. by nitin.sh1982
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |