sub last { my $self = shift; # ... } sub uidl { my $self = shift; # ... while(defined($line = $self->getline())) { $line =~ /^\.\s*$/ and last; # ... } # ... }