On 6/27/07, Alma <[EMAIL PROTECTED]> wrote: snip
return @row;
snip
Is there any way that we can return the multiple row values from the subroutine.
snip
Return does not work like you think it does. It return immediately. If you wish to return a list then you need to return a list (not individual values). Either build an array using push, or better yet use the fetchall method. Also, learn to indent blocks and use whitespace. Putting everything on left hand side and all scrunched up is unreadable. sub display { my $self = shift; #$id = @_; # I don't think this is what you mean try this instead my ($id) = @_; my $sth = $dbh->prepare(" select title, name, status from table where id = emp_id and status ='P' "); #$sth->execute() or die $databasehandle->errstr; #boy are you going to be surprised on an error, try this instead $sth->execute() or die $dbh->errstr; #or better yet, just add RaiseError => 1 during the connect return @{$sth->selectall_arrayref}; } My calling program is my @row = abc->display(); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/