sub to_string { my $self = shift; return "$self->{num}/$self->{den}"; } sub to_num { my $self = shift; return $self->{num} / $self->{den}; }